Displaying full total with the selected category total grouped by month


Thanks to every one who is supporting here.

I have a query:
Table A: supplierid, suppliername
TableB: ordernum, supplierid, category, orderqty, orderdate

  1. grouping is done by month
  2. total quantity is irrespective of category qty
  3. Category would be passed by parameter in storedproc
  4. Whole idea is that user wishes to see the how many units of a category has been ordered againt the total quantity of a month

I want results something like :
ordrnum suppliername categoryqty totalqty
Jan 123 abc 100 1000

Feb 456 qwe 200 3000

Mar 789 str 150 1500

what query should be passed to achieve this.

Many thanks in advance.

I would look at set grouping and rollup/cube. That will do group totals and overall totals. This is a link to an excellent article to help get you going with that:

Simple Talk and Group Totals

That site has great articles and I highly recommend reading it.