标题: group by 语句后面跟一个条件该如何理解? [打印本页] 作者: Ronins 时间: 2014-2-28 11:37 标题: group by 语句后面跟一个条件该如何理解? /*
create table tb0A
(
u_id int not null,
kemu int not null,
socre int not null
);
insert into tb0a(u_id,kemu,socre)
values(1,1,80);
insert into tb0a(u_id,kemu,socre)
values(1,2,75);
insert into tb0a(u_id,kemu,socre)
values(1,3,90);
]*/
/*
这是小弟网上看到的一个group by语句后跟一个这样的条件对结果有影响,请问各位大神,这句话该如何理解,比如说他的其他让人看的懂的写法,
*/
select kemu,socre from tb0a group by 1=0;--这句话能把表中数据全部查出来
select kemu,socre from tb0a group by 1=1;--这句话只能把第一条(80)数据给查出来
select kemu,socre from tb0a group by socre > 75;--这句话只能将(80,75)查出来;