开发者

The multi-part identifier could not be bound

I have this very simple sql statement:

SELECT     max_dose
FROM     开发者_如何学C    psychotropes
WHERE     (patient_meds.psychotrope = psychotrope_name) AND (patient_meds.patient_id = 12)

when I try to run it in Visual Studio 2008, it tells me "The multi-part 'patient_meds.psychotrope' identifier could not be bound"

it's weird, because I did set a relationship between the two tables in the diagram viewer


I guess you'll have to include patient_meds in the table list as:

FROM psychotropes, patient_meds


You are not including the table in the query. Without knowing the schema this is just an assumption. Also a database diagram does nothing to assist in queries.

SELECT ax_dose
FROM psychotropes
INNER JOIN patient_meds ON psychotropes.psychotrope_name = patient_meds.psychotrope
WHERE (patient_meds.patient_id = 12)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜