?
Solved

Problem with Query....

Posted on 2008-10-15
4
Medium Priority
?
226 Views
Last Modified: 2011-09-20
Hi there,

Simple query that I cant get to run, this is the query:

SELECT m.*, mt.restricts, b.Module
FROM mat_trnkld m, matprt_trnkld mt LEFT JOIN BOM b
ON m.PartNo = b.partnumber
WHERE m.PartNo = mt.PartNo
AND m.SubProd = '50'

and I'm getting this error:

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


Thanks,

Stelly
0
Comment
Question by:stellyuk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 5

Accepted Solution

by:
jfmador earned 1000 total points
ID: 22727769
Define your join between mat_trnkld and matprt_trnkld before using the left join

Try this
SELECT m.*, mt.restricts, b.Module
FROM mat_trnkld m INNER JOIN matprt_trnkld mt on m.PartNo = mt.PartNo
LEFT JOIN BOM b ON m.PartNo = b.partnumber
WHERE m.SubProd = '50'
0
 
LVL 2

Assisted Solution

by:Deepika_Rastogi
Deepika_Rastogi earned 1000 total points
ID: 22728139
Hi

As matprt_trnkld and BOM are joined with each other we can't use mat_trnkld in the bound.
Instead in the bound condition mention the tables that are joined.
so try this

SELECT m.*, mt.restricts, b.Module
FROM mat_trnkld m, matprt_trnkld mt LEFT JOIN BOM b
ON mt.PartNo = b.partnumber
WHERE m.PartNo = mt.PartNo
AND m.SubProd = '50'

Hope you find the solution.
Deepika

0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question