Table One
ID Code Amount
1 2 100
2 2 200
Table Two
ID Key Description
1 12 Bag
2 22 Cap
我想加入連接兩列的select兩個表中的一個表。在表格中說我想在t1.id + t1時加入它們。代碼= t2.key。在圖形我想22 = 22
或12 = 12
其中在第一面22 or 21
是t1.id+t1.code
連接上的concat 2列值sql
查詢:
Select *
from table1 AS t1 INNER JOIN table2 AS t2 ON (t1.id +""+ t1.code)= t2.key
錯誤:
Msg 1038, Level 15, State 4, Line 1 An object or column name is missing or empty. For SELECT INTO statements, verify each column has a name. For other statements, look for empty alias names. Aliases defined as "" or [] are not allowed. Change the alias to a valid name.