Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个包含重复城市名称的数据集。我希望得到所有的记录,如果城市是重复的,那么就得到第一个:
1 London Fred 2 Paris Sally 3 London Marce
我想要这个返回:
1 London Fred 2 Paris Sally
我正在使用 SQLite,但这并不重要。
SELECT a.* FROM tableName a ( SELECT countryName, MIN(id) minID FROM tableName GROUP BY countryName ) b ON a.id = b.minID -- AND a.countryName = b.countryName