i am pulling data from a an MySQL data base that i want to order in some useful way but as fare as i can tell if try and order the data on more than one field name the data still looks a bit scrambled. here is my SQL:
SELECT * FROM news ORDER BY cleint_text AND date_year DESC;
and this is what i get back:
year cleint_text product_text
2005 Fuller Smith and Turner product 2
2005 Noon products Ltd product 2
2005 Fuller Smith and Turney product 4
2005 Fuller Smith and Turner product 3
2005 Fuller Smith and Turner product 5
2003 sainsburys product 1
2003 Fuller Smith and Turner product 2
2004 Sainsburys product 2
2005 Sainsburys product 3
2003 Noon products Ltd product 1
2003 noon products Ltd product 2
2003 premier foods product 3
2003 Fuller Smith and Turner product 3
2003 Sainsburys product 4
2004 Sainsburys product 1
2004 Fuller Smith and Turner product 6
2004 Sainsburys product 6
2004 Fuller Smith and Turner product 5
2004 Sainsburys product 2
but this is what i would like to get back: the data separated out into years the client and then possible product text. i could do it be selecting distinct dates and then running separate SQL query on each year but that seems like a bit of along winded way of doing things. or is there some kind of magic php array function i don’t know about any ideas?
this is what i want:
year cleint_text product_text
2005 Fuller Smith and Turner product 2
2005 Fuller Smith and Turner product 3
2005 Fuller Smith and Turney product 4
2005 Fuller Smith and Turner product 5
2005 Noon products Ltd product 2
2005 Sainsburys product 3
2004 Fuller Smith and Turner product 5
2004 Fuller Smith and Turner product 6
2004 Sainsburys product 1
2004 Sainsburys product 2
2004 Sainsburys product 2
2004 Sainsburys product 6
2003 Fuller Smith and Turner product 2
2003 Fuller Smith and Turner product 3
2003 Noon products Ltd product 1
2003 noon products Ltd product 2
2003 premier foods product 3
2003 sainsburys product 1
2003 Sainsburys product 4
any help will be cool
kev