sql server, left join on,on附近有语法错误
selectcast(Service_Order_Noasnvarchar)+CAST(Item_Noasnvarchar)as'Key1',Service_Order_...
select cast(Service_Order_No as nvarchar)+CAST(Item_No as nvarchar) as 'Key1',
Service_Order_No, Item_No
from dbo.GH_Billing_ID_TH_MY_IN as A
left join
(select cast([Service Order ID] as nvarchar)+CAST([Service Order Line] as nvarchar) as 'Key2',
[Service Order ID],[Service Order Line]
from dbo.SO_Raw_All as B)
on A.Key1= B.Key2;
提示:
消息 156,级别 15,状态 1,第 8 行
关键字 'on' 附近有语法错误。
谢谢 展开
Service_Order_No, Item_No
from dbo.GH_Billing_ID_TH_MY_IN as A
left join
(select cast([Service Order ID] as nvarchar)+CAST([Service Order Line] as nvarchar) as 'Key2',
[Service Order ID],[Service Order Line]
from dbo.SO_Raw_All as B)
on A.Key1= B.Key2;
提示:
消息 156,级别 15,状态 1,第 8 行
关键字 'on' 附近有语法错误。
谢谢 展开
2个回答
展开全部
select cast(Service_Order_No as nvarchar)+CAST(Item_No as nvarchar) as 'Key1',
Service_Order_No, Item_No
from dbo.GH_Billing_ID_TH_MY_IN A
left join
(select cast([Service Order ID] as nvarchar)+CAST([Service Order Line] as nvarchar) as 'Key2',
[Service Order ID],[Service Order Line]
from dbo.SO_Raw_All ) B
on A.Key1= B.Key2;
Service_Order_No, Item_No
from dbo.GH_Billing_ID_TH_MY_IN A
left join
(select cast([Service Order ID] as nvarchar)+CAST([Service Order Line] as nvarchar) as 'Key2',
[Service Order ID],[Service Order Line]
from dbo.SO_Raw_All ) B
on A.Key1= B.Key2;
追问
提示说:
消息 207,级别 16,状态 1,第 8 行
列名 'Key1' 无效。
请问是为什么呢?
追答
select (cast(Service_Order_No as nvarchar)+CAST(Item_No as nvarchar) )as 'Key1',
Service_Order_No
这个地方错了
对应的,这个地方也错了
select (cast([Service Order ID] as nvarchar)+CAST([Service Order Line] as nvarchar)) as 'Key2',
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |