请教,一条查询语句,各位多多指点
数据如下,表名rain_beibei,有四个字段,我想查询一个月内Nrain>0的个数,
SELECT
count(Nrain)
FROM
rain_beibei
WHERE
rain_beibei.Nrain > '0'
AND rain_beibei.`date` like '1951-1';
得出的结果是0,为什么不是5,请各位多多指教
最好能给一条显示一个月内Nrain,Train,Arain大于0的天数的语句,三个字段不同时>0
date Nrain Train Arain
1951-1-1 0 0 0
1951-1-2 0 0 0
1951-1-3 0 0 0
1951-1-4 0 0 0
1951-1-5 0 0 0
1951-1-6 0 0 0
1951-1-7 0 0 0
1951-1-8 0 0 0
1951-1-9 4 29 33
1951-1-10 21 3 24
1951-1-11 2 0 2
1951-1-12 5 6 11
1951-1-13 0 0 0
1951-1-14 0 0 0
1951-1-15 0 0 0
1951-1-16 0 0 0
1951-1-17 0 0 0
1951-1-18 0 0 0
1951-1-19 0 0 0
1951-1-20 0 4 4
1951-1-21 10 3 13
1951-1-22 0 0 0
1951-1-23 0 1 1
1951-1-24 0 1 1
1951-1-25 0 0 0
1951-1-26 0 0 0
1951-1-27 0 0 0
1951-1-28 0 0 0
1951-1-29 0 0 0
1951-1-30 0 0 0
1951-1-31 0 0 0
1951-2-1 0 0 0
1951-2-2 0 4 4
1951-2-3 1 0 1
1951-2-4 16 3 19
1951-2-5 0 0 0
1951-2-6 0 0 0
1951-2-7 0 0 0
1951-2-8 0 0 0
1951-2-9 0 0 0
1951-2-10 0 0 0
1951-2-11 0 0 0
1951-2-12 0 0 0
1951-2-13 0 0 0
1951-2-14 0 0 0
1951-2-15 31 21 52
1951-2-16 0 0 0
1951-2-17 0 0 0
------解决方案--------------------
SQL code
select date_format(`date`,'%Y-%m'),
sum(Nrain),sum(Train),sum(Arain)
from rain_beibei
group by date_format(`date`,'%Y-%m');