Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL - Difference between ORDER and GROUP
Message
From
13/09/1999 12:19:52
 
 
To
13/09/1999 11:29:15
Peter Brama
West Pointe Enterprises
Detroit, Michigan, United States
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00264016
Message ID:
00264045
Views:
18
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform