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 MovI 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 50I 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()?