I cant remember the right aproach in php to sort data from related tables anymore? Iam not sure if its even possible in one query?
table brands
id name
------------
1 Disney
2 Pepsi
3 Sony
table products
id name brandId
-----------------------
1 cd-playerX 3
2 nice poster 1
3 usb-radio 3
4 cd-playerY 3
I want to list all the products sorted by the name of the brand table (order=asc) like this:
- nice poster (Disney)
- cd-playerX (Sony)
- cd-playerY (Sony)
- usb-radio (Sony)
Anyone?
1 Answer