1
Assuming I have two tables in my database (pedidos
and pedidos_itens
) how I can obtain data from requests ordered by orders containing more items?
I’ve tried to make a Right Join, but I don’t know what to use in the clause order by, since my goal is to sort by the number of records in the table pedidos_itens
.
How do you know which orders contain the most items? is a number in one of the fields of each entry or the amount of entries with a given ID?
– Sergio
Each row of the table
pedidos_itens
is an item, so you would have to sort the query by the number of rows in the tableitens_pedidos
– wmarquardt