大于1: select count(a1) from where a1>1 group by a2 小于1: select count(a1) from where a1<1 group by a2 不等于1: select count(a1) from where a1<>1 group by a2
学会举一反三呀~补充:Group By 用于统计,一般与 Count() 一起用
select count(a1) from table1 group by a2
select count(a1) from table1 group by a2
呵呵,你们都误解我的意思拉.我要的是在同一行中显示, 我已经知道怎么做了,不过还是很感谢你们。下面是具体的方法: select count(a1), sum(decode(a1-1,0,1,0)) from table1 group by a2
用sum不是求和了吗?好像不对啊! select count(al)||' al=1' from table1 where a1=1 union all select count(al)||' al<>1' from table1 where al<>1 这样行不行 我是菜虫,多多指教
还要统计a1<>1的情况,怎么办啊,急!!!
小于1: select count(a1) from where a1<1 group by a2
不等于1: select count(a1) from where a1<>1 group by a2
我已经知道怎么做了,不过还是很感谢你们。下面是具体的方法:
select count(a1), sum(decode(a1-1,0,1,0))
from table1
group by a2
select count(al)||' al=1' from table1 where a1=1
union all
select count(al)||' al<>1' from table1 where al<>1
这样行不行
我是菜虫,多多指教
//shy