Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL - Difference between ORDER and GROUP
Message
De
13/09/1999 12:19:52
 
 
À
13/09/1999 11:29:15
Peter Brama
West Pointe Enterprises
Detroit, Michigan, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00264016
Message ID:
00264045
Vues:
17
>What is the difference between ORDER BY and GROUP BY?

Hi Peter,

As Pete said, ORDER BY should be enough for you, but I'll give an example of GROUP BY, if you don't mind.

Let's assume the following simple table, which would be the child table of an invoice:
InvNo         Amount
--------------------
0001          120.00
0002           40.00
0001           15.00
0001           10.00
0002           20.00
GROUP BY will usually be used with a function such as SUM(). For example, if what you want is the total for each invoice, SELECT InvNo, SUM(Amount) AS Total FROM InvDetail GROUP BY InvNo would return:
InvNo      Total
----------------
0001      145.00
0002       60.00
I hope this clears things up a little!
Sylvain Demers
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform