title: Two Union from same Table-H2 Database
body: <p>I am facing little problem with my query, i want to show 2 <code>union all</code> in single select statement, but only union all is working.</p>
  
  <p>Working Query:</p>
  
  <pre><code>    select '' as Total, product, price,sellprice, 
  openingstock as openingStock, openingstock*price as op_value, 
  receipts as receipts, receipts*price as re_value, 
  totalstock as totalstock, totalstock*price as ts_value, 
  sales as sales, sales*sellprice as s_value, 
  return as returns,return*sellprice as rt_value, 
  closingstock as closingstock, closingstock*price as cl_value   
  from purchase_table where date between '2017-04-01' and  '2017-05-30'
  union all 
   select orgname , 'Total', sum(price),sum(sellprice), 
  sum(openingstock) as openingStock, sum(openingstock*price) as op_value, 
  sum(receipts) as receipts, sum(receipts*price) as re_value, 
  sum(totalstock) as totalstock, sum(totalstock*price) as ts_value, 
  sum(sales) as sales, sum(sales*sellprice) as s_value, 
  sum(return) as returns,sum(return*sellprice) as rt_value, 
  sum(closingstock) as closingstock, sum(closingstock*price) as cl_value   
  from purchase_table  where date between '2017-04-01' and  '2017-05-30'  group by orgname order by closingstock asc 
  </code></pre>
  
  <p>when i add another Union all its not working</p>
  
  <pre><code>select '' as Total, product, price,sellprice, 
  openingstock as openingStock, openingstock*price as op_value, 
  receipts as receipts, receipts*price as re_value, 
  totalstock as totalstock, totalstock*price as ts_value, 
  sales as sales, sales*sellprice as s_value, 
  return as returns,return*sellprice as rt_value, 
  closingstock as closingstock, closingstock*price as cl_value   
  from purchase_table where date between '2017-04-01' and  '2017-05-30'
  union all 
   select orgname , 'Total', sum(price),sum(sellprice), 
  sum(openingstock) as openingStock, sum(openingstock*price) as op_value, 
  sum(receipts) as receipts, sum(receipts*price) as re_value, 
  sum(totalstock) as totalstock, sum(totalstock*price) as ts_value, 
  sum(sales) as sales, sum(sales*sellprice) as s_value, 
  sum(return) as returns,sum(return*sellprice) as rt_value, 
  sum(closingstock) as closingstock, sum(closingstock*price) as cl_value   
  from purchase_table  where date between '2017-04-01' and  '2017-05-30'  group by orgname order by closingstock asc 
  
  union all
  select '' , '', sum(price),sum(sellprice), 
  sum(openingstock) as openingStock, sum(openingstock*price) as op_value, 
  sum(receipts) as receipts, sum(receipts*price) as re_value, 
  sum(totalstock) as totalstock, sum(totalstock*price) as ts_value, 
  sum(sales) as sales, sum(sales*sellprice) as s_value, 
  sum(return) as returns,sum(return*sellprice) as rt_value, 
  sum(closingstock) as closingstock, sum(closingstock*price) as cl_value   
  from purchase_table  
  </code></pre>
  
  <p>What am doing wrong here please help</p>