第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

選擇每個(gè)組的最大值

選擇每個(gè)組的最大值

紫衣仙女 2019-09-24 10:47:11
Name    Value   AnotherColumn-----------Pump 1  8000.0  Something1Pump 1  10000.0 Something2Pump 1  10000.0 Something3Pump 2  3043    Something4Pump 2  4594    Something5Pump 2  6165    Something6我的桌子看起來像這樣。我想知道如何為每個(gè)泵選擇最大值。select a.name, value from out_pumptable as a,(select name, max(value) as value from out_pumptable where group by posnumber)g where and g.value = value這段代碼可以完成工作,但是我得到了Pump 1的兩個(gè)條目,因?yàn)樗袃蓚€(gè)具有相同值的條目。
查看完整描述

3 回答

?
白板的微信

TA貢獻(xiàn)1883條經(jīng)驗(yàn) 獲得超3個(gè)贊

select name, max(value)

from out_pumptable

group by name


查看完整回答
反對 回復(fù) 2019-09-24
?
MM們

TA貢獻(xiàn)1886條經(jīng)驗(yàn) 獲得超2個(gè)贊

select name, value 

from( select name, value, ROW_NUMBER() OVER(PARTITION BY name ORDER BY value desc) as rn

from out_pumptable ) as a

where rn = 1


查看完整回答
反對 回復(fù) 2019-09-24
  • 3 回答
  • 0 關(guān)注
  • 473 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號