I have a orders table with the following columns:
-userid
-orderid (primary key)
-date
-name
-qty
So I would like to display in tables in a summary page all orders and group them under each userid. So it would be like
Userid: 0001
| Orderid | Name | QTY |
| 1001 | Item A | 10 |
| 1002 | Item B | 5 |
Userid: 0003
| Orderid | Name | QTY |
| 1003 | Item C | 6 |
| 1004 | Item C | 7 |
So far I’ve experimented and got:
- display in a single table all the items ordered by userid
- with a GROUP BY userid, I’ve managed to create as many tables as there are different userid
But I can’t seem to combine the two into the desired results and would really appreciate some advice on what I am doing wrong.
Thanks in advance and I hope my explanation made sense!
I think you will need to do this in PHP
Query with
In PHP something like this psudo code