Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Data grouping with the reference of last transaction
Message
From
30/03/2003 09:01:53
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Data grouping with the reference of last transaction
Miscellaneous
Thread ID:
00771821
Message ID:
00771821
Views:
58
Hi everybody.
I want to generate a file, which gives me the following data for each customer and stock number –
Customer number, stock number, total sell, reference of the last transaction like document type, date, document number and unit price
I tried following SQL -
SELECT CUST_NO, STOCK_NO, MAX(DOC_DATE), DOC_TYPE, DOC_NO, ;
       (NET / QTY) AS UNIT_RATE, SUM(NET) AS TOT_NET ;
FROM t_invch ;
INTO CURSOR inv_cur ;
GROUP BY CUST_NO, STOCK_NO
With this, I got the total sell and last transaction date correctly. But other details like DOC_TYPE, DOC_DATE etc. of the last record, not of the last transaction date. What should be the proper SQL for this query?

Thanks in advance.
Yashodhan.
Next
Reply
Map
View

Click here to load this message in the networking platform