mysql 中写sql语句咱和mssql不一样的?

chenam 2007-10-06 09:16:20
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后,也就是带上多条件,就没有效果了呢????
...全文
77 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
码出钞能力 2007-10-11
  • 打赏
  • 举报
回复
大伙用什末客户端查询工具?
chenam 2007-10-07
  • 打赏
  • 举报
回复
是没有效果的,
如果

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

这样就可效果了
为何?

懒得去死 2007-10-07
  • 打赏
  • 举报
回复
怎么就没有效果了,例子:
1、


select (case when 2 is not null and 3 is null then 'shit' end) shit;



Query select (case when 2 is not null and 3 is null then 'shit' end) shit, Sun Oct 07 07:11:08 2007
shit
NULL

2、


select (case when 2 is not null or 3 is null then 'shit' end) shit;


Query select (case when 2 is not null or 3 is null then 'shit' end) shit, Sun Oct 07 07:11:59 2007
shit
shit


56,679

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧