How to write a SQL query to group records by field and return an array in the result?
For example, there is a table with a history of orders. There are fields ID , ID_CLIENT , SUMMA , ORDER :
ID= This is the order number.ID_CLIENT= Client ID to which the order belongsSUMMA= Order AmountORDER= Order List
With a normal query, select * from order group by id_client returns one order from client.
I need to end up with a three-dimensional array like this:
$list[ID_CLIENT][ID_ORDER]- Array with order information$list[ID_CLIENT]- Array with orders$list= Array with clients
group_concathas limitations - BOPOH