Looks like you are trying to query the same table so in effect different result sets, if you are you can join the subs something like this:SELECT a.item, a.docdate, SUM(a.value), SUM(a.qty), SUM(a.total) FROM RunTotalTestData a INNER JOIN (Select SUM(b.value) rtvalue FROM RunTotalTestData) b ON b.item=a.item AND b.docdate <= a.docdate INNER JOIN (SELECT SUM(c.qty) rtqty, SUM(c.total) rttotal FROM RunTotalTestData) c ON c.item=a.item AND c.docdate <= a.docdate GROUP BY a.item,a.docdate