选择配置单元中的最大客户id

mtb9vblg  于 2021-06-27  发布在  Hive
关注(0)|答案(2)|浏览(381)


我想从同一帐号中选择最大客户id。

select max (customer_ID),account_number
from Account
group by account_number
having account_number ='30010258'

结果是

我希望结果是

30byixjq

30byixjq1#

选择max(int(customer\u id)),account\u number from account group by account\u number having account\u number='30010258'

col17t5w

col17t5w2#

使用 where 从句代替 having .
注意:如果account\u number是int类型,则删除30010258周围的引号。如果customer\u id的数据类型是string,则必须将其转换为int。

select max (customer_ID),account_number
from Account
where account_number ='30010258'
group by account_number

相关问题