求高手解答。SQL语句执行报错。
SELECTa.OrderNoASOrderItemNo,a.OrderItemNoASOrderNo,a.CreateTime,D.AreaNoASOrderCity,...
SELECT
a.OrderNo AS OrderItemNo,a.OrderItemNo AS OrderNo, a.CreateTime,D.AreaNo AS OrderCity, b.Status, b.ConsumeMerchant,1 AS Quantity, a.CommodityOriginPrice,a.CommodityOriginPrice AS OriginPrice, a.Price AS Amount,a.VendorNo,b.ExpenseValue,b.ValidateDate as PayTime, E.OriginPercent, CASE WHEN E.OriginPercent IS NULL THEN 0 ELSE b.ExpenseValue / E.OriginPercent END AS TicketPoint, b.VoucherNo
FROM control.tb_OrderDetails as a INNER JOIN
control.tb_Voucher as b ON a.VoucherNo = b.VoucherId LEFT OUTER JOIN
control.tb_Area AS D ON control.tb_Order.OrderCity = D.AreaNo LEFT OUTER JOIN
control.v_GetMerchantPriceTemplate AS E ON E.OrgCode = 'zhongying' AND a.VendorNo = E.PartnerNo
----------------------------------------------------------------------------------------------------------
执行后报错。
消息 4104,级别 16,状态 1,第 1 行
无法绑定由多个部分组成的标识符 "control.tb_Order.OrderCity"。 展开
a.OrderNo AS OrderItemNo,a.OrderItemNo AS OrderNo, a.CreateTime,D.AreaNo AS OrderCity, b.Status, b.ConsumeMerchant,1 AS Quantity, a.CommodityOriginPrice,a.CommodityOriginPrice AS OriginPrice, a.Price AS Amount,a.VendorNo,b.ExpenseValue,b.ValidateDate as PayTime, E.OriginPercent, CASE WHEN E.OriginPercent IS NULL THEN 0 ELSE b.ExpenseValue / E.OriginPercent END AS TicketPoint, b.VoucherNo
FROM control.tb_OrderDetails as a INNER JOIN
control.tb_Voucher as b ON a.VoucherNo = b.VoucherId LEFT OUTER JOIN
control.tb_Area AS D ON control.tb_Order.OrderCity = D.AreaNo LEFT OUTER JOIN
control.v_GetMerchantPriceTemplate AS E ON E.OrgCode = 'zhongying' AND a.VendorNo = E.PartnerNo
----------------------------------------------------------------------------------------------------------
执行后报错。
消息 4104,级别 16,状态 1,第 1 行
无法绑定由多个部分组成的标识符 "control.tb_Order.OrderCity"。 展开
展开全部
应该这样写吧
FROM control.tb_OrderDetails as a INNER JOIN
control.tb_Voucher as b LEFT OUTER JOIN
control.tb_Area AS D LEFT OUTER JOIN
control.v_GetMerchantPriceTemplate AS E
ON (a.VoucherNo = b.VoucherId
and control.tb_Order.OrderCity = D.AreaNo
and E.OrgCode = 'zhongying' AND a.VendorNo = E.PartnerNo)
你试试
tb_Order 这个表 好像没有写进来 在from后面没有它
FROM control.tb_OrderDetails as a INNER JOIN
control.tb_Voucher as b LEFT OUTER JOIN
control.tb_Area AS D LEFT OUTER JOIN
control.v_GetMerchantPriceTemplate AS E
ON (a.VoucherNo = b.VoucherId
and control.tb_Order.OrderCity = D.AreaNo
and E.OrgCode = 'zhongying' AND a.VendorNo = E.PartnerNo)
你试试
tb_Order 这个表 好像没有写进来 在from后面没有它
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
FROM control.tb_OrderDetails as a INNER JOIN
control.tb_Voucher as b ON a.VoucherNo = b.VoucherId LEFT OUTER JOIN
control.tb_Area AS D ON control.tb_Order.OrderCity = D.AreaNo LEFT OUTER JOIN
你上面的control.tb_Order.OrderCity 这里出问题,你加多一个inner join control.tb_Order as X 之类的,不能直接这样用
control.tb_Voucher as b ON a.VoucherNo = b.VoucherId LEFT OUTER JOIN
control.tb_Area AS D ON control.tb_Order.OrderCity = D.AreaNo LEFT OUTER JOIN
你上面的control.tb_Order.OrderCity 这里出问题,你加多一个inner join control.tb_Order as X 之类的,不能直接这样用
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询