我要从相同的帐号中选择最大客户ID。
select max (customer_ID),account_number
from Account
group by account_number
having account_number ='30010258'
结果是
我希望结果是
答案 0 :(得分:0)
使用where
子句代替having
。
注意:如果account_number为int类型,则删除30010258周围的引号。如果customer_ID的数据类型为字符串,则必须将其强制转换为int。
select max (customer_ID),account_number
from Account
where account_number ='30010258'
group by account_number
答案 1 :(得分:0)
选择最大值(int(customer_ID)),帐号 来自帐户 按account_number分组 具有account_number ='30010258'