2014-01-14 60 views
3

我見過幾個編寫CE函數的例子。 BUt,我還沒有遇到任何例子,在不同名稱的列上執行連接。CE加入不同名稱的列

例如:

隨着SQL:

select T1.col1, T1.col2, T1.col3 , T2.col4, T2.col5, T2.col6 

from  table1 T1 

inner join table2 T2 

on T1.col3 = T2.col7 

符合CE功能:

table1 = CE_COLUMN_TABLE("SCHEMA"."TABLE1",["col1","col2","col3"]); 

table2 = CE_COLUMN_TABLE("SCHEMA"."TABLE2",["col4","col5","col6","col7"]); 

var_out = CE_JOIN(:table1,:table2,[??],[]) 

任何人都可以請幫我完成連接語句。

感謝 這裏網格

回答

4

的技巧使用投影節點。投影將允許您重命名列和過濾數據。你可以這樣做:

prj_1 = CE_PROJECTION(:emp_table,["ID","FNAME", "LNAME", "AGE", "PAY" AS "SALARY"], '"PAY"' > 1000); 

prj_2 = CE_PROJECTION(:address,["EMP_ID" AS "ID", "ADDR1", "ADDR2", "ZIP"]); 

join_1 = CE_JOIN(:prj_1, :prj_2, ["ID"]); 
相關問題