Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Group by
Message
 
 
To
20/08/2007 14:48:22
Issam Mansour
Jordan Business Machines
Amman, Jordan
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01249183
Message ID:
01249184
Views:
17
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform