dkfr.net
当前位置:首页 >> orAClE怎么在whErE后面再作判断条件 >>

orAClE怎么在whErE后面再作判断条件

你可以根据时间参数来判断: 如果时间>=你的时间 且 status = 1 这个条件 ; 如果时间=v_date and status =1 ) or (time

你这样太复杂了。 无非就是下面几种: 1. exists where exists (select 1 from abc where xxx) 2. in where xxx in (select xxx from abc where ...) 3. = (只能返回一行) where xxx = (select xxx from abc where ...) 当然,子查询中是可以使...

你应该这样写 select * from 表 where 1=1 and (case when a=1 then a when 表.字段='asdfasdf' then b end)='值

select a.* from (select * from b) a

group by后面条件用having,举例如下: SELECT dept_id, SUM(salary) FROM employees GROUP BY dept_id HAVING SUM(salary) < 5000;

准确的是: with a as (exec @你的很长的SQL) select 1 from a

网站首页 | 网站地图
All rights reserved Powered by www.dkfr.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com