I'm trying to get records from db and I want to first order it by something and when that is established the the order it by something else... My db has following tables... id uid name aproved I want to first get all the records that has been aproved (the record for this is 1, if not aproved it has a 0). When that is established I want to show all the records for that user first alphabetic and then all the others in alphabetic order... Hope this is understandable...
What database are you using - Mysql or SQL Server? id, uid, name and approved are fields or columns, not tables. What is the name of the table?
SELECT * FROM test WHERE approved = 1 ORDER BY name ASC Code (markup): I think you should read some mysql tutorials first as these are the most basic queries in mysql.
Hey, i entirely agree with greg. Sometimes humping in the deep end is the best way but not in this case! Most programs come with a built in tutorial. This will guide you through the basics and lay a good foundation as you progress and need to learn more. Trust me, i learned the hard way (a number of times!)