Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Group by
Message
 
 
À
20/08/2007 14:48:22
Issam Mansour
Jordan Business Machines
Amman, Jordanie
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Versions des environnements
SQL Server:
SQL Server 2005
Divers
Thread ID:
01249183
Message ID:
01249184
Vues:
19
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform