Click to See Complete Forum and Search --> : ORDER BY Multiple Columns


tomyknoker
04-17-2007, 09:51 AM
I am trying to order by multiple columns, here is my example and what I want to output

Code
ORDER BY lastName ASC, State ASC

Output
James Anna, Alabama
Ben Bloggs, Alabama
Chris Cats, Alabama
Mark Aims, Delaware

Hopefully you can see what I am trying to achieve, but I don't get there all it does is sort the result by lastName and ignores the states...

russell
04-17-2007, 10:21 AM
ORDER BY State ASC, lastName ASC

drallab
04-20-2007, 11:40 AM
When ordering, it will order in succession. Order the lastname first, then order it by state.

So it will sort your results by lastname, then it will sort those results by the state. If you wanted the state to be sorted first and then the lastname, then the above post will work.

Just thought it would be a good FYI. :)