How to select distinct rows with a specified condition
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Suppose there is a table _ _ a 1 a 2 b 2 c 3 c 4 c 1 d 2 e 5 e 6 How can I select distinct minimum value of all the rows of each group? So the expected result here is: _ _ a 1 b 2 c 1 d 2 e 5 EDIT My actual table contains more columns and I want to select them all. The rows differ only in the last column (the second one in the example). I'm new to SQL and possibly my question is ill-formed in it initial view. The actual schema is: | day | currency ('EUR', 'USD') | diff (integer) | id (foreign key) | The are duplicate pairs (day, currency)