I need to join some if
's and I'm having trouble,
I have already tried using union
, but to no avail.
The query I'm running is:
IF (select count(Estado)
FROM tbl_1
where Estado != 'WIP' AND Estado !='on hold') > 0
BEGIN
SELECT 'Estado NOK: ', Nome, (Estado), SLA from tbl_1
where (Estado != 'WIP' AND Estado !='on hold')
END
ELSE
BEGIN
SELECT 'Estado OK'
END
----------
//e o outro if seria:
----------
IF (select count(SLA)
FROM tbl_1
where SLA != '24x7' AND SLA != '10x8') >0
BEGIN
SELECT 'Dados NOK: ', Nome, Estado, (SLA) from tbl_1
where (SLA != '24x7' AND SLA != '10x8')
END
ELSE
BEGIN
SELECT 'Dados OK'
END
What I need is for these two queries to be united into one.