Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Data grouping with the reference of last transaction
Message
De
30/03/2003 09:01:53
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Data grouping with the reference of last transaction
Divers
Thread ID:
00771821
Message ID:
00771821
Vues:
57
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.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform