Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL query
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01001558
Message ID:
01001561
Views:
17
Try
SELECT SalesmanID, SUM(Total) AS Sales, COUNT(*) AS Orders ;
  FROM mytable ;
  GROUP BY 1 
>This should be an easy SQL statement but I cannot figure out how to do it.
>
>I have a table with sales summary info to keep it simple
>
>
Inv_Date   Date
>Total      N10.2
>SalesmanID C5
>
>I want to create an sql statment that sums each salesman's sales and count's the number of orders to a cursor/table.
>
>So my resulting table would look like:
>
>
Salesman     Sales    Orders
>MCMW       210,382        14
>ALCS       155,417        12
>PCKD       120,232         8
>
>I do some SQL but not none that generates summary info. Can I do this in SQL, or do I need to do it the old fashioned way?
>
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform