August 8, 2003 at 1:41 am
Hi,
Just wondering if anyone can help here.
I have a table, tb_sales, where each transaction for over 700 customers is logged. I.e.
a100
a100
b111
c222
1/1/2002
2/1/2002
1/1/2002
1/1/2002
11.1
10.5
22.2
15.5
.
.
I need to return the total sales for each customer for any given year.
A kick in the right direction would be very much apprieciated.
Cheers
Ritch
*I didn't do anything it just got complicated*
Edited by - Ritch on 08/08/2003 01:54:54 AM
"I didn't do anything it just got complicated" - M Edwards
August 8, 2003 at 2:05 am
What you need to do is create a store procedure which accepts a date as parameter.
Then using a where clause filter out the records for this date.
Then use the group by command and group by customerid.
e.g. use northwind database
select shippername,sum(extendedprice)
from invoices
where requireddate='1996-10-23 00:00:00.000'
group by shippername
Relationships are like Banks. You Invest the Principal and then get the Interest
He who knows others is learned but the wise one is one who knows himself.
August 8, 2003 at 2:09 am
Thanks mate! Hang overs don't do much for my logic
*I didn't do anything it just got complicated*
Edited by - Ritch on 08/08/2003 04:20:16 AM
"I didn't do anything it just got complicated" - M Edwards
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply