MySQL - SELECT the name that comes first alphabetically

后端 未结 11 1536
悲&欢浪女
悲&欢浪女 2020-12-24 08:50

I have started to learn MySQL.

Here is the table world:

+-------------+-----------+---------+
|    name     | continent |  area   |
+--         


        
11条回答
  •  -上瘾入骨i
    2020-12-24 09:02

    SELECT  distinct x.continent , x.name
    FROM world x ,world y 
    WHERE x.name = (SELECT y.name FROM world y
     WHERE y.continent=x.continent order by y.name asc limit 1 ) ;
    

提交回复
热议问题