Solved

Problem with Query....

Posted on 2008-10-15
4
219 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
4 Comments
 
LVL 5

Accepted Solution

by:
jfmador earned 250 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 250 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

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.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

708 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now