x

problem in Joining the tables

Hello all i am executing the following code:

 SELECT  A.KFC_ID,
         A.Date_of_request,
         B.plc_Name_long,
         E.Broker_GivenName,
         E.Email
 FROM    table_KFC_KFC A,
         table_Broker E
 INNER JOIN table_plc B ON A.plc_id = B.plc_id
 INNER JOIN table_KFC_role R ON E.Broker_ID = R.Broker_ID
 WHERE   R.role_id IN (100, 145, 698, 775, 1)



when executed the following query then i am getting the following Error:

 Msg 4104, Level 16, State 1, Line 1
 The multi-part identifier "A.plc_id" could not be bound.

please suggest how can i rectify this error.

more ▼

asked Apr 19, 2012 at 08:05 AM in Default

avatar image

sand143eep
881 37 50 55

(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first

The error means that the column '`plc_id`' is not present in the table '`table_KFC_KFC`'. Make sure that the join to '`table_plc`' is using the correct column(s).

Also reconsider the query in regards to the table '`table_Broker`' - you are using the old style join syntax (is the cross join onto '`table_KFC_KFC`' desired?).

more ▼

answered Apr 19, 2012 at 08:14 AM

avatar image

WilliamD
26.2k 18 34 48

thanks actually the table_kfc_role was not clearly related which thrown error.

Apr 19, 2012 at 09:05 AM sand143eep
 SELECT distinct 
                 A.KFC_ID,
                 A.Date_of_request,
                 B.plc_Name_long,
                 E.Broker_GivenName AS [PM Name],
                 E.Email 
      FROM table_KFC_KFC A
 
      INNER JOIN table_plc B
      ON A.plc_id = B.plc_id
      INNER JOIN table_KFC_role R
      on r.KFC_header_id = a.KFC_header_id
      INNER JOIN table_Broker E
      ON E.Broker_ID = R.Broker_ID
 WHERE  R.role_id in(100,145,698,775,1)



this code when i added it executed successfully.

Apr 19, 2012 at 09:09 AM sand143eep

If that is the case, please mark this question as answered so we all know you have been helped out.

Apr 19, 2012 at 09:22 AM WilliamD

never mind, I marked it as answered.

Apr 19, 2012 at 09:51 AM Grant Fritchey ♦♦
(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x2016

asked: Apr 19, 2012 at 08:05 AM

Seen: 459 times

Last Updated: Apr 19, 2012 at 09:51 AM

Copyright 2016 Redgate Software. Privacy Policy