itblog(i like i do) select 购物人,[count]=count(商品名称) from 表名 group by 购物人 having count(商品名称)>1 ----------------------------------------------------------------------------------- 你这个是错的 我指的是不同种类的商品而不是你所说的商品的个数
select 购物人,[count]=count(distinct 商品名称) from 表名 group by 购物人 having count(distinct 商品名称)>1
--表 create table sd(name varchar(10),kecheng varchar(10),fenshu int) insert sd select '张三','语文',81 union all select '张三','数学',75 union all select '李四','语文',76 union all select '李四','数学',90 union all select '王五','语文',81 union all select '王五','数学',100 union all select '王五','英语',90 --执行语句 select * from sd where name not in(select name from sd a where exists(select * from sd where name=a.name and a.fenshu<80)) --or select distinct name from sd where name not in(select name from sd a where exists(select * from sd where name=a.name and a.fenshu<80))
这个怎么做,不好意思哈
用一条SQL语句 查询出每门课都大于80分的学生姓名 name kecheng fenshu
张三 语文 81
张三 数学 75
李四 语文 76
李四 数学 90
王五 语文 81
王五 数学 100
王五 英语 90
select 购物人,[count]=count(商品名称) from 表名 group by 购物人 having count(商品名称)>1
-----------------------------------------------------------------------------------
你这个是错的
我指的是不同种类的商品而不是你所说的商品的个数
create table sd(name varchar(10),kecheng varchar(10),fenshu int)
insert sd select '张三','语文',81
union all select '张三','数学',75
union all select '李四','语文',76
union all select '李四','数学',90
union all select '王五','语文',81
union all select '王五','数学',100
union all select '王五','英语',90
--执行语句
select * from sd where name not in(select name from sd a where exists(select * from sd where name=a.name and a.fenshu<80))
--or
select distinct name from sd where name not in(select name from sd a where exists(select * from sd where name=a.name and a.fenshu<80))
结贴了
多谢itblog(i like i do)!!!!!!!!!!!