select 1 from table

1  select 1 from 中的1是一常量,查到的所有行的值都是它, --增加临时列--,每行的列值是写在select后的数 (常用作判断条件);

2  查看记录条数用select sum(a) from table; 不管count(a)的a值如何变化,得出的值总是table表的行数

    等价于select sum(*) from table; 

3  select sum(1) from table   计算临时列的和

posted @ 2016-03-18 10:43  不会r闪怪腾讯  阅读(211)  评论(0编辑  收藏  举报