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)查出来;
请问各位大神,group by 后面跟这些条件该如何理解?希望能翻译成平凡人的写法;
建议按照标准sql语法来写,以免得到异常数据。 我把你的脚步执行了下,但也不是你说的结果呀。不会解释了。
貌似gourp by 后的数字表示select后的字段,按顺序。 admin 发表于 2014-2-28 17:42
我把你的脚步执行了下,但也不是你说的结果呀。不会解释了。
貌似gourp by 后的数字表示select后的字段, ...
太神奇了,我再搜搜。谢谢。
页:
[1]