Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Databases

It's not clearly understood on applying multiple conditions to alphabetize names in a query. Any advice?

As the code attached demonstrates, I don't quite comprehend what needs rectified to make this legible SQL.

I don't understand how not adding a comma makes this work, in my mind the following makes sense but does not take: [...] ORDER BY last_name ASC, ORDER BY first_name ASC LIMIT 20 OFFSET 60;

If guidance could be offered, I'd be most grateful. Thank you!

1 Answer

Steven Parker
Steven Parker
231,269 Points

You only use ORDER BY once, then list the conditions separated by commas:

ORDER BY last_name ASC, ORDER BY first_name ASC  -- so instead of this
ORDER BY last_name ASC, first_name ASC           -- do this

Thank you Steven!! Your response helped a lot! :)