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)
精彩评论