SQL Selecting multiple columns based on max value in one column

后端 未结 6 1667
天涯浪人
天涯浪人 2021-02-07 12:22

OK so I have looked theough the other solutions an no help. So here is what I am trying to do. I need to select the row with multiple columns where the value in one column is th

6条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-07 12:51

    I think what you are looking for is the "Having" clause. Take a look at this.

    select orderfileid, max(itemnumber), itemcost, warehouse from MyTable group by orderfileid having max(itemnumber) ;

提交回复
热议问题