新人求大神解释解释sql语句

qq_22465835 2014-10-24 09:53:16
select t.*,( case when (select count(1) from t_xdt_usual_question_type t1 where  t1.PARENT_TAG=t.issue_TYPE )>0 then 'true' else 'false' end ) 
as isparent from t_xdt_usual_question_type t where 1=1;


看不懂这个sql语句 请大神指教
...全文
85 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
wangwei 2014-10-24
  • 打赏
  • 举报
回复
select t.*, (case when (select count(1) from t_xdt_usual_question_type t1 where t1.PARENT_TAG = t.issue_TYPE) > 0 then 'true' else 'false' end) as isparent from t_xdt_usual_question_type t where 1 = 1; 查询表t_xdt_usual_question_type 所有字段以及isparent字段 isparent字段显示有下面查询确定 如果查询select count(1) from t_xdt_usual_question_type t1 where t1.PARENT_TAG = t.issue_TYPE) > 0 结果大于0 isparent字段显示为true 否则显示为false
bw555 2014-10-24
  • 打赏
  • 举报
回复
select t.*,( case when (select count(1) from t_xdt_usual_question_type t1 where t1.PARENT_TAG=t.issue_TYPE )>0 then 'true' else 'false' end ) as isparent from t_xdt_usual_question_type t where 1=1; case when 条件1 then 结果1 else 结果2 end的用法 当满足条件的时候,返回结果1,不满足返回结果2

17,082

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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