Two queries in one hit

  • I have written many simple queries but I have to run them sequentially. How can I run two questions in one query?

    For example:

    Give me the total of sales in June

    Give me the total of sales in July

    I would like the answer thus:

    Sales

    June

    July

    I hope this makes sense. Thank you in advance.

  • Could you give us more info please? Maybe give a couple of the queries you want to combine, show what they return now and show what you want them to return.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • select

    datename(mm, SalesDate) as Month,

    sum(TotalSale) as TotalSales

    from

    dbo.SalesOrder

    group by

    datename(mm, SalesDate)

    order by

    datepart(mm, SalesDate);

    Something like that??

    😎

  • Thank you.

    I'll get back with a more detailed example.

  • Thank you.

    I'll get back with a more detailed example.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply