从SQL表中获取城市和国家/地区列表

gyu*_*isc 1 sql linq linq-to-sql

我有一个SQL表,在每行中我存储国家和城市的东西位置.例如:

record1, New York, USA
record2, Rome, Italy
record3, Milano, Italy
record3, Birghiman, UK 
record4, London, UK
record5, London, UK
record6, London, UK
record7, Birmingham, UK

我想生成一个按国家和城市排序的列表,每个城市只在结果中显示一次.

我想知道如何以优雅的方式在SQL和Linq To SQL中解决这个问题.

CSh*_*Atl 9

select distinct country, city
from <Table>
order by country, city;
Run Code Online (Sandbox Code Playgroud)