select AccountDID,Productslice,Productcount,LCSCount from (select coalesce (a.AccountDID,b.AccountDID) as AccountDID,a.ProductSlice,
sum(isnull(a.ProductCount,0)) ProductCount,sum(isnull(b.LCSCount,0)) LCSCount,b.RdbSliceCode from #ProductAudit a
full outer join #LCSAudit b on a.AccountDID=b.AccountDID and a.ProductSlice=b.RdbSliceCode
group by a.AccountDID,b.AccountDID,a.ProductSlice,b.RdbSliceCode)a where LCSCount<>ProductCount
here #ProductAudit table contain one column i.e levelCapability and #LCSAudit contain one column i.e usergroupname
So i want to use case in above query like..the condition is..
if in #ProductAudit table ...levelCapability =="recruitment" and in #LCSAudit table ..... usergroupname==null than i want to select the account did..
How can i do it?

Mithilesh KumarRank #378 · 6.7K reputationPosted Aug 8, 2019, 9:01 PM EDT
Amit MohantyRank #112 · 20K reputationPosted Aug 8, 2019, 10:16 PM EDT
Sonu GuptaRank #1,261 · 1.4K reputationPosted Aug 11, 2019, 7:50 PM EDT