Skip to content
Advertisement

Sort by last name and first name

I have a small little problem. I am have a drop down list that displays all of our customers names. As of right now, the list is sorted by last name (A-Z). But for example, there are 250 people with the last name “Smith”. What I need is a way that the last name of each customer to stay the way it is but I need the first names to be listed alphabetically as well. Here is an example:

What I would like is this:

Here is how I am pulling the list now:

Advertisement

Answer

Adjust your SQL statement, add the ORDER BY clause with the appropriate field names:

ORDER BY last_name ASC, first_name ASC

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement