多部分标识符“auto_parts.car_id”无法受约束。在sql中 [英] The multi-part identifier "auto_parts.car_id" could not be bound. in sql

查看:60
本文介绍了多部分标识符“auto_parts.car_id”无法受约束。在sql中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

select Auto_Parts.Car_id,convert(varchar, Auto_Parts.Change_date,111) as Change_date,Service_Type.Servce_desc
,Auto_Parts.Current_dist,Auto_Parts.Prev_dist,(convert(float,Current_dist) - convert(float,Prev_dist)) as Change_dist
,(a.Value_Part) as Value,NULL as [Qty] from Auto_Part_Details a

JOIN (SELECT Car_id, MAX(Current_dist) as m FROM Auto_Parts  GROUP BY Car_id) b ON Auto_Parts.Car_id = b.Car_id
inner join Auto_Parts  on a.Job_Card = Auto_Parts.Job_Card
INNER JOIN Service_Type ON Auto_Parts.Servce_id = Service_Type.Servce_id

WHERE Auto_Parts.Current_dist > m - 3002 AND Auto_Parts.Car_id = 555
ORDER BY Change_date desc ,Current_dist DESC  





我的尝试:



此代码是两个表,表(auto_Part)具有常量值,表(Auto_Part_Details)是Car_id



What I have tried:

this code is two table,table( auto_Part) have constant value ,table(Auto_Part_Details) is details for Car_id

推荐答案

为Auto_Parts表的所有引用添加别名。
Add an alias for all references to the Auto_Parts table.


这篇关于多部分标识符“auto_parts.car_id”无法受约束。在sql中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆