欧美一区二区三区,国内熟女精品熟女A片视频小说,日本av网,小鲜肉男男GAY做受XXX网站

sql怎么查詢一個列的最大值

方一強2年前14瀏覽0評論

sql怎么查詢一個列的最大值?

方法一SELECTID,Name,(SELECTMAX(LastUpdateDate)FROM(VALUES(UpdateByApp1Date),(UpdateByApp2Date),(UpdateByApp3Date))ASUpdateDate(LastUpdateDate))ASLastUpdateDateFROM##TestTable方法二SELECTID,[Name],MAX(UpdateDate)ASLastUpdateDateFROM##TestTableUNPIVOT(UpdateDateFORDateValIN(UpdateByApp1Date,UpdateByApp2Date,UpdateByApp3Date)

)ASuGROUPBYID,Name方法三SELECTID,name,(SELECTMAX(UpdateDate)ASLastUpdateDateFROM(SELECTtt.UpdateByApp1DateASUpdateDateUNIONSELECTtt.UpdateByApp2DateUNIONSELECTtt.UpdateByApp3Date)ud)LastUpdateDateFROM##TestTablett