Assuming I have two tables in my database ( pedidos
and pedidos_itens
) how can I get the data from the orders sorted by the orders that contain the most items?
I have tried to do a Right Join , but I do not know what to use in the order by clause, since my goal is to sort by the number of records in the% .