Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Retrieve total and subtotal
Message
From
30/10/2000 17:01:33
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Retrieve total and subtotal
Miscellaneous
Thread ID:
00436113
Message ID:
00436113
Views:
46
I need to return one recordset a column for each record but also another column for subtotal of that same column. This is something like how I've done it in VFP:

SELECT orderid, itemid, qty FROM itemtable WHERE orderid=123 INTO CURSOR cTItem

SELECT itemid, SUM(qty) AS subtotal FROM itemtable ;
WHERE orderid=123 GROUP BY itemid INTO CURSOR cTItem2

SELECT A.orderid, A.itemid, A.qty, B.subtotal ;
FROM cTItem A JOIN cTItem2 B ;
ON A.itemid=B.itemid ;
INTO CURSOR cWhatINeed

If the DB is now MSSQL and the app is now VB, how would I handle something like this? TIA.
It's "my" world. You're just living in it.
Next
Reply
Map
View

Click here to load this message in the networking platform