select job_id from sysjobhistory where
message like '%The job failed%'
这句话查询结果2,3,4,5 select job_id from sysjobactivity where stop_execution_date between dateadd(day,-1,getdate()) and getdate()
这句话查询结果1,2,3 若得出查询结果取得公共部分,也就是2,3 SQL语句怎么写? 谢谢。
message like '%The job failed%'
这句话查询结果2,3,4,5 select job_id from sysjobactivity where stop_execution_date between dateadd(day,-1,getdate()) and getdate()
这句话查询结果1,2,3 若得出查询结果取得公共部分,也就是2,3 SQL语句怎么写? 谢谢。
message like '%The job failed%'
intersect--交集
select job_id from sysjobactivity where stop_execution_date between dateadd(day,-1,getdate()) and getdate()
message like '%The job failed%'
union
select job_id from sysjobactivity where stop_execution_date between dateadd(day,-1,getdate()) and getdate()
message like '%The job failed%' and job_id in (
select job_id from sysjobactivity where stop_execution_date between dateadd(day,-1,getdate()) and getdate()
)