dadamssg87 Posted November 26, 2011 Share Posted November 26, 2011 Is there a way in sql to order rows by a last name and then within the blocks of the same last name, by first name? For example, Abe Adams Corey Adams Terry Alberts Christi Baron John Bellamie Zachary Bellamie Travis Mathews Jon Morgan You'll notice Adams and Bellamie both have two people and they then ordered by their first name. Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted November 26, 2011 Share Posted November 26, 2011 You can ORDER BY any number of parameters. Quote Link to comment Share on other sites More sharing options...
dadamssg87 Posted November 26, 2011 Author Share Posted November 26, 2011 i realize that but if i only order by last name, the first name doesn't get taken into account if there are several names with the same last name Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted November 27, 2011 Share Posted November 27, 2011 ORDER BY last_name_column, first_name_column Quote Link to comment Share on other sites More sharing options...
fenway Posted November 27, 2011 Share Posted November 27, 2011 Assuming you've stored them separately, of course. Also, alphabetical sorting isn't technically correct when it comes to last names. Quote Link to comment Share on other sites More sharing options...
dadamssg87 Posted November 27, 2011 Author Share Posted November 27, 2011 what do you mean by that, fenway? Quote Link to comment Share on other sites More sharing options...
fenway Posted November 27, 2011 Share Posted November 27, 2011 what do you mean by that, fenway? I mean that "McMahon" is supposed to be sorted before "Mackenzie". 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.