Forums

This topic is locked

Help with recordset please.

Posted 12 Nov 2002 14:04:59
1
has voted
12 Nov 2002 14:04:59 Russell Marshall posted:
I have a table which contains invoice lines and I am trying to produce a recordset that will produce a list by client with the total owed by that client.

The problem I am having is producing a recordset that will list each client once (maybe using DISTINCT) with the sum of all the invoice lines not paid by that client.

The table looks like this

Company PaidYN PriceLine

Company1 NO 100.00
Company1 NO 10.00
Company2 YES 100.00
Company1 YES 50.00
Company2 NO 60.00

The output I require is

Company Name Total Owed

Company1 110.00
Company2 60.00
ect

The recordset needs to list each company once and calculate the total owed based on PaidYN = NO

Is it possible to do this?


Russell

Replies

Replied 12 Nov 2002 14:52:05
12 Nov 2002 14:52:05 Dennis van Galen replied:
Let's see, I think you want something like:

SELECT DISTINCT Company, SUM(PriceLine) AS Total_Owed
FROM invoice
WHERE (PaidYN NOT LIKE YES)
GROUP BY Company

Invoice being this table's name.


With kind regards,

Dennis van Galen
Webmaster KPN Services
Financial and Information Services
Replied 12 Nov 2002 15:29:03
12 Nov 2002 15:29:03 Russell Marshall replied:
Thanks Glen,

I'll give it a whirl.

Davrus

Russell
Replied 12 Nov 2002 15:29:15
12 Nov 2002 15:29:15 Russell Marshall replied:
Thanks Glen,

I'll give it a whirl.

Davrus

Russell
Replied 12 Nov 2002 16:12:09
12 Nov 2002 16:12:09 Russell Marshall replied:
Thanks Dennis.

This works fine.

Best Regards

Davrus

Russell
Replied 12 Nov 2002 16:12:18
12 Nov 2002 16:12:18 Russell Marshall replied:
Thanks Dennis.

This works fine.

Best Regards

Davrus

Russell

Reply to this topic