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