select
(case when sheng is null then 'hj' else sheng end)sheng,
(case when sheng is not null and shi is null then 'xj' else shi end)shi,
count(ip) as num from ip
where date>='2007-01-01' and date<='2007-10-10'
group by sheng,shi with rollup
==
mysql 中
(case when sheng is not null and shi is null then 'xj' else shi end)shi
这句带上and后,也就是带上多条件,就没有效果了呢????
(case when sheng is null then 'hj' else sheng end)sheng,
(case when sheng is not null and shi is null then 'xj' else shi end)shi,
count(ip) as num from ip
where date>='2007-01-01' and date<='2007-10-10'
group by sheng,shi with rollup
==
mysql 中
(case when sheng is not null and shi is null then 'xj' else shi end)shi
这句带上and后,也就是带上多条件,就没有效果了呢????
如果select
(case when sheng is null then 'hj ' else sheng end)sheng,
(case when sheng is not null and shi is null then 'xj ' else shi end)shi,
count(ip) as num
from (
select * from ip
where date >= '2007-01-01 ' and date <= '2007-10-10 '
group by sheng,shi with rollup )a这样就可效果了
为何?