MS Access SQL: Aggregating on Min Value but retrieving other fields

六月ゝ 毕业季﹏ 提交于 2019-12-01 23:58:29

Assuming that the second line of what you like to get is [2 2 2.5], this is what you're looking for:

select a.col1, a.colm, m.col3
from
    (
        select col1, min(col2) as colm
        from test
        group by col1
    ) as a
inner join test m on a.col1 = m.col1 and a.colm = m.col2
JJG

You can use a subquery:

select t.col1, tt.col2 , tt.col3
from (
      SELECT col1, Min(col2) AS mcol2
      FROM Tmp
      group by col1) t,  tmp tt
where t.col1 =  tt.col1 and t.mcol2 = tt.col2
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!