SELECT DISTINCT stationno, sum(colamt1) AS colamt1, 0 AS colamt2 ; from mytable ; WHERE tranno=1 ; INTO CURSOR tmp NOFILTER; GROUP BY stationnoworks fine.
SELECT DISTINCT stationno, 0 AS colamt1, sum(colamt2) AS colamt2 ; from mytable ; WHERE tranno=2 ; INTO CURSOR tmp NOFILTER; GROUP BY stationnoHow do I UNION these two selects? Or JOIN them? to get one table that sums colamt1 where transno=1 (while leaving colamt2 zero) AND sums colamt2 where transno=2 (while leaving colamt1 zero)