CanMan2004 Posted September 21, 2006 Share Posted September 21, 2006 Hi allI have a database which holds a top ten, I have one field called `position` and another called `type`, there are 10 rows with a `type` of 1 and each row has a value in the field called `position` which range from 0-9, within this table, I also have another 10 rows with a `type` of 2 and each row has a value in the field called `position` which range from 0-9.The table looks likeid position type 1 0 2 2 1 2 3 2 2 4 3 2 5 4 2 6 5 2 7 6 2 8 7 2 9 8 2 10 9 2 11 0 1 12 1 1 13 2 1 14 3 1 15 4 1 16 5 1 17 6 1 18 7 1 19 8 1 20 9 1I run a query which looks like[code]$sql = "SELECT * FROM top10 ORDER BY position ASC LIMIT 10";[/code]It supposed to return the rows in the following orderposition type0 20 11 21 12 22 13 23 14 24 1but for some reason, it is returning the results as0 20 11 11 22 12 23 13 24 14 2basically its supposed to show type 1 then type 2 then type 1 then type 2 then type 1 then type 2 and so on, so the results are mixed evenly.Does that make sense? What am I doing wrong?Thanks in advanceDave Quote Link to comment Share on other sites More sharing options...
Alteczen Posted September 21, 2006 Share Posted September 21, 2006 I think you can just add another sort to it: $sql = "SELECT * FROM top10 ORDER BY position, type ASC LIMIT 10"; Quote Link to comment Share on other sites More sharing options...
CanMan2004 Posted September 21, 2006 Author Share Posted September 21, 2006 thank you thank you thank you Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.