Jump to content

select column1 from mysql WHERE column2 = (first alphabetically)


deansatch

Recommended Posts

Basically I am trying to do that literal statement:

select column1 from mysql WHERE column2 = (first alphabetically) order by column1 asc

 

There should be multiple results. i.e. column1 is car models, column2 is car manufacturers. So I want to get all models ONLY by the manufacturer that comes first alphabetically.

 

Is there a way to do this before I resort to 2 separate queries?

Well.... writing that actually made me think more logically and I solved it myself within seconds!!!

 

SELECT DISTINCT model FROM vans

WHERE manufacturer  = (SELECT manufacturer FROM vans ORDER BY manufacturer desc LIMIT 1)

ORDER BY model asc"

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.