web sales sql query

OK - you SQL scripting gurus.. I need to run a query that pulls all sales under mos 52 and 57, showing just date and amount. I am sure this is not difficult for those that know how to do this, but I'm not there yet in my SQL knowledge. Would anyone mind assisting me with this easy query?

Parents
  • Perfect! I’ll give it a try!

     

    Thank you

     


    From: Tessitura Technical Forum [mailto:forums-technical@tessituranetwork.com] On Behalf Of Chris Jensen
    Sent: Friday, July 30, 2010 3:02 PM
    To: Randall A. Mitchell
    Subject: Re: [Tessitura Technical Forum] web sales sql query

     

    Randall Mitchell:

    yes - thats great! thanks. How then do I get the total of sales by month for each yr?

    That's a bit more challenging. I would use a custom calendar table, which I read about here:

    http://sqlserver2000.databases.aspfaq.com/why-should-i-consider-using-an-auxiliary-calendar-table.html

    ... which is very handy for stuff like this. One quick way could be something like this:

    select  left(convert(varchar(20), order_dt, 100),3) "month",
        sum(tot_due_amt) "tot_due_sum"
    from t_order
    where mos in (52,57)
    group by left(convert(varchar(20), order_dt, 100),3)
    order by month

    From: Randall Mitchell <bounce-randallmitchell8646@tessituranetwork.com>
    Sent: 7/30/2010 4:50:21 PM

    yes - thats great! thanks. How then do I get the total of sales by month for each yr?




    This message was sent automatically to you by www.tessituranetwork.com because you subscribed to the Tessitura Technical Forum. You may reply to this message to post to the Technical forum or visit the site to search, read and post to the forums. In the interest of keeping the forum posts from becoming cluttered, we encourage you to delete previous message text from your reply before sending. Thank you!

Reply
  • Perfect! I’ll give it a try!

     

    Thank you

     


    From: Tessitura Technical Forum [mailto:forums-technical@tessituranetwork.com] On Behalf Of Chris Jensen
    Sent: Friday, July 30, 2010 3:02 PM
    To: Randall A. Mitchell
    Subject: Re: [Tessitura Technical Forum] web sales sql query

     

    Randall Mitchell:

    yes - thats great! thanks. How then do I get the total of sales by month for each yr?

    That's a bit more challenging. I would use a custom calendar table, which I read about here:

    http://sqlserver2000.databases.aspfaq.com/why-should-i-consider-using-an-auxiliary-calendar-table.html

    ... which is very handy for stuff like this. One quick way could be something like this:

    select  left(convert(varchar(20), order_dt, 100),3) "month",
        sum(tot_due_amt) "tot_due_sum"
    from t_order
    where mos in (52,57)
    group by left(convert(varchar(20), order_dt, 100),3)
    order by month

    From: Randall Mitchell <bounce-randallmitchell8646@tessituranetwork.com>
    Sent: 7/30/2010 4:50:21 PM

    yes - thats great! thanks. How then do I get the total of sales by month for each yr?




    This message was sent automatically to you by www.tessituranetwork.com because you subscribed to the Tessitura Technical Forum. You may reply to this message to post to the Technical forum or visit the site to search, read and post to the forums. In the interest of keeping the forum posts from becoming cluttered, we encourage you to delete previous message text from your reply before sending. Thank you!

Children
No Data