| harvinder 2002-11-20, 2:23 pm |
| Hi,
we have a following query
select
au.id_sess,
(CASE WHEN (au.col1 IS NULL OR au.col4 = 'D')
THEN 'Y' ELSE 'N' END) AS CanBeAdjusted
FROM tab1 au
INNER JOIN tab2 tui on tui.col1 = au.col1
where au.id_sess in (11002, 11003,11004)
GROUP BY
au.id_sess
and the result is:
id_sess CanBeAdjusted
11002 Y
11002 N
11003 Y
11004 N
but we need to eleminate records where id_sess has value
of CanBeAdjusted='N' and it already has value 'Y'
so in our case(we need to eleminate id_Sess=11002 row
having value 'N') how we can modify query to get results
like this:
id_sess canbeadjusted
11002 Y
11003 Y
11004 N
Thanks
--Harvinder
|