HI,I have used a pivot query but I'm not sure how to use rollup in the query to get the total at the bottom of the results.Table is similar to below.date | product | organisation | price1 july 2012 | biscuitA | xyz | 331 july 2012 | icecreamA | abc | 451 july 2012 | biscuitB | abc | 221 july 2012 | biscuitA | def | 331 july 2012 | biscuitB | xyz | 222 july 2012 | biscuitA | def | 332 july 2012 | icecreamA | xyz | 452 july 2012 | icecreamA | abc | 452 july 2012 | biscuitB | abc | 223 july 2012 | biscuitA | def | 333 july 2012 | icecreamA | xyz | 453 july 2012 | biscuitA | xyz | 33My code is below. select product, [xyz] as xyz, [abc] as abc, [def] as def, sum([xyz] + [abc] + [def] as Totalfrom(select date, product, price, organisation from table1) as tpivot(sum(price) for organisation in ([xyz], [abc], [def]) )as newquerygroup by product, abc, xyz, def
The query works fine but now I want to display total at the bottom of the results. I tried 'with rollup' in the last line of my code after group by but it does not produce result as I wanted.