SELECT CustNo, Disb_rt_no, Disb_ddaNo, ; DisbddAmt + $0000.00 AS DisbddAmt, ; $0000.00 AS Prin_pmt, $0000.00 AS Int_pmt ; FROM Disb_dda ; UNION ALL ; SELECT CustNo, Pmt_rt_no, Pmt_dda_no, ; $0000.00 AS DisbddAmt, ; Prin_pmt, Int_pmt ; FROM Payment ; INTO CURSOR Temp1 SELECT CustNo, Disb_rt_no, Disb_ddaNo, ; SUM(DisbDdAmt) AS Total_DisbDdAmt, ; SUM(Prin_pmt) AS Total_Payments, ; SUM(Int_pmt) AS Total_Interest ; FROM Temp1 ; INTO CURSOR Temp2 ; GROUP BY CustNo, Disb_rt_no, Disb_ddaNo>I have the following UNION ALL SQL which creates a record that contains fields from two other tables. Now I want unique custno, column2, column3, and sum on column4, column5 and column6. In the UNION ALL I could not see how to say "INTO" so that I could assign a cursor name. Also, my Union All fields had some '**' in some columns. What are the astericks?
>Select custno, disb_rt_no, disb_ddano, disb_dda.disbddaamt, ; >0.00, 0.00 From disb_dda ; >Union All ; >Select custno, pmt_rt_no, pmt_dda_no, 0.00, prin_pmt, int_pmt From payment