Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The multi-part identifier could not be bound

Tags:

sql

I have this very simple sql statement:

SELECT     max_dose
FROM         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

like image 381
jello Avatar asked Mar 28 '10 04:03

jello


People also ask

What is a multipart identifier?

A multipart identifier is any description of a field or table that contains multiple parts - for instance MyTable. SomeRow - if it can't be bound that means there's something wrong with it - either you've got a simple typo, or a confusion between table and column.

What is invalid object name in SQL?

This typically means 1 of 2 things... you've referenced an object (table, trigger, stored procedure,etc) that doesn't actually exist (i.e., you executed a query to update a table, and that table doesn't exist). Or, the table exists, but you didn't reference it correctly...

Where is SQL?

The SQL WHERE clause is used to specify a condition while fetching the data from a single table or by joining with multiple tables. If the given condition is satisfied, then only it returns a specific value from the table.


1 Answers

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

FROM psychotropes, patient_meds
like image 94
codaddict Avatar answered Sep 22 '22 05:09

codaddict