Anyone point me in the right direction?

  • 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.

    • f_Customer

      a100

      a100

      b111

      c222

    • f_Date_Rec

      1/1/2002

      2/1/2002

      1/1/2002

      1/1/2002

    • f_Val

      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

  • 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.

  • 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