>Hi,
>
>I Have the following "select statement" with "group by condition", I want the outgoing result for the query to be vno with (scamt <> sdamt) the example is as following:-
>
>select vno,vtype,tdate,sum(camt) as scamt,sum(damt) as sdamt
>from transact
>where year = 2007 and scamt <> sdamt
>group by vno,vtype,tdate
>order by vno
>
>Thanks
Put the condition into HAVING clause, e.g.
>select vno,vtype,tdate,sum(camt) as scamt,sum(damt) as sdamt
>from transact
>where year = 2007
group by vno,vtype,tdate
having scamt <> sdamt
>order by vno
If it's not broken, fix it until it is.
My Blog