How to Use a correlated subquery to get sum of colums for particular items
select itemid from table1 A
where col1 = 'sp'
and amt <>
(select sum(amt) from table1 B
where B.itemid = A.itemid
and col1 in ('a','b')
)
;
select itemid from table1 A
where col1 = 'sp'
and amt <>
(select sum(amt) from table1 B
where B.itemid = A.itemid
and col1 in ('a','b')
)
;
0 comments:
Post a Comment