New to SQL, so bear with me.....
I have a Payments table that has the following fields:
Doc_Date Ledger_Gross Ledger_Net
-------- ------------ -------
1/1/01 100 90
2/1/01 100 90
3/1/01 200 180
I need a quesry that will return 5 items:
1 - Total Gross
2 - Total Net
3 - Total deducations
4 - Last pay date
5 - Last pay amount
I got the first 4 with the following:
SELECT
SUM(Payment.LEDGER_GROSS),
SUM(Payment.LEDGER_NET),
SUM(Payment.Ledger_Gross - Payment.Ledger_Net),
MAX(Payment.Doc_Date)
Now, I can't figure out how to get the value of the payment associated with the Last pay date (Doc_Date).
Help.......
- Mike
I have a Payments table that has the following fields:
Doc_Date Ledger_Gross Ledger_Net
-------- ------------ -------
1/1/01 100 90
2/1/01 100 90
3/1/01 200 180
I need a quesry that will return 5 items:
1 - Total Gross
2 - Total Net
3 - Total deducations
4 - Last pay date
5 - Last pay amount
I got the first 4 with the following:
SELECT
SUM(Payment.LEDGER_GROSS),
SUM(Payment.LEDGER_NET),
SUM(Payment.Ledger_Gross - Payment.Ledger_Net),
MAX(Payment.Doc_Date)
Now, I can't figure out how to get the value of the payment associated with the Last pay date (Doc_Date).
Help.......
- Mike