Posted in 面试题 onDecember 18, 2012
表结构如下
————————————
Buyer Name Quantity
A 甲 2
B 乙 4
C 丙 1
A 丁 2
B 丙 5
请给出所有购入商品为两种或两种以上的购物人记录
select Buyer as 顾客,count(name) as 商品种类数 from table group by Buyer having count(name)>=2
select * from table where Buyer in (select Buyer from table group by Buyer having count(name)>=2)
————————————
Buyer Name Quantity
A 甲 2
B 乙 4
C 丙 1
A 丁 2
B 丙 5
请给出所有购入商品为两种或两种以上的购物人记录
select Buyer as 顾客,count(name) as 商品种类数 from table group by Buyer having count(name)>=2
select * from table where Buyer in (select Buyer from table group by Buyer having count(name)>=2)
金蝶的一道SQL笔试题
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Tags in this post...
Reply on: @reply_date@
@reply_contents@