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.