Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Running Total - Summary Data
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Running Total - Summary Data
Miscellaneous
Thread ID:
00726469
Message ID:
00726469
Views:
33
I have following data in SQL Server:
InventTrans:

RecId Loct Batch Qty  TType
1     AAA  001    20  Rec
2     AAA  001    30  Rec
3     BBB  002    20  Rec
4     BBB  002    30  Rec
5     AAA  001    -9  Isu
6     CCC  001     0  Mov
7     CCC  002     0  Mov
I would like to get a result set as below through SQLExec(), which I get in VFP by
SELECT RecId, Loct,Batch,sum(Qty) ;
FROM InventTrans ;
GROUP BY Batch

RecId Loct Batch Qty
6     CCC  001    41
7     CCC  002    50
I tried to run above on SQL Server, but it requires Loct column to be aggregated, which I don't want to do, since I could have any value in it, but I want the last Loct in the result set. Could you suggest a way of doing above by SQLExec()?

Thank you,
Yashkamal Patel
Next
Reply
Map
View

Click here to load this message in the networking platform