Experts,
Please help, I am trying to write a view that enables a list to be produced where other views in the database have a count > 0 ... but when I run this I only get a result returned for the first WHEN statement, the others are not returned, even though they have a count > 0 ?? Help please ... suggestions on approach if I am coming at this the wrong way.
Thanks in Advance
SELECT 'VIEWS TO BE CHECKED' =
CASE
WHEN((SELECT COUNT(1) AS A FROM NN_TblToFunctio nalLocationMast er) >= '0') THEN 'NN_TblToFuncti onalLocationMas ter'
WHEN((SELECT COUNT(1) AS A FROM OI_TblToFunctio nalLocationMast er) >= '0') THEN 'OI_TblToFuncti onalLocationMas ter'
WHEN((SELECT COUNT(1) AS A FROM SD_TblToFunctio nalLocationMast er) >= '0') THEN 'SD_TblToFuncti onalLocationMas ter'
WHEN((SELECT COUNT(1) AS A FROM SS_TblToFunctio nalLocationMast er) >= '0') THEN 'SS_TblToFuncti onalLocationMas ter'
ELSE NULL
END
Please help, I am trying to write a view that enables a list to be produced where other views in the database have a count > 0 ... but when I run this I only get a result returned for the first WHEN statement, the others are not returned, even though they have a count > 0 ?? Help please ... suggestions on approach if I am coming at this the wrong way.
Thanks in Advance
SELECT 'VIEWS TO BE CHECKED' =
CASE
WHEN((SELECT COUNT(1) AS A FROM NN_TblToFunctio nalLocationMast er) >= '0') THEN 'NN_TblToFuncti onalLocationMas ter'
WHEN((SELECT COUNT(1) AS A FROM OI_TblToFunctio nalLocationMast er) >= '0') THEN 'OI_TblToFuncti onalLocationMas ter'
WHEN((SELECT COUNT(1) AS A FROM SD_TblToFunctio nalLocationMast er) >= '0') THEN 'SD_TblToFuncti onalLocationMas ter'
WHEN((SELECT COUNT(1) AS A FROM SS_TblToFunctio nalLocationMast er) >= '0') THEN 'SS_TblToFuncti onalLocationMas ter'
ELSE NULL
END
Comment