* Group data SELECT NVL(t1.date, t2.date) AS date, NVL(t1.code, t2.code) AS code, SUM(t1.sale_in) AS in, SUM(t2.sale_out) AS out ; FROM table1 t1 FULL JOIN table2 t2 ON t1.date = t2.date ; GROUP BY 1,2 ; ORDER BY 1,2 ; INTO CURSOR crsDataThe second one could be one of following:
> Create Cursor table1 ; > (date d(8),code Char(7),name Char(20), sale_in N(12)) > > Insert Into table1 Values ({^2008-01-15},'1401001','eric',10) > Insert Into table1 Values ({^2008-01-15},'1401002','bill',20) > Insert Into table1 Values ({^2008-01-16},'1401001','eric',30) > Insert Into table1 Values ({^2008-01-17},'1401001','eric',40) > Insert Into table1 Values ({^2008-01-18},'1401001','eric',50) > Insert Into table1 Values ({^2008-01-17},'1402001','tushar',40) > Insert Into table1 Values ({^2008-01-18},'1402003','samir',50) > > Create Cursor table2; > (date d(8),code Char(7),name Char(20), sale_out N(12)) > > Insert Into table2 Values ({^2008-01-15},'1401001','eric',110) > Insert Into table2 Values ({^2008-01-15},'1401002','bill',120) > Insert Into table2 Values ({^2008-01-16},'1401001','eric',130) > Insert Into table2 Values ({^2008-01-17},'1401001','eric',140) > Insert Into table2 Values ({^2008-01-18},'1401001','eric',150) > Insert Into table2 Values ({^2008-01-17},'1402001','tushar',140) > Insert Into table2 Values ({^2008-01-18},'1402003','samir',150) >>I need folloiwng result