Solved

Problem with Query....

Posted on 2008-10-15
4
225 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 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

Get Actionable Data from Your Monitoring Solution

Your communication platform is only as good as the relevance of the information you send. Ensure your alerts get to the right people every time with actionable responses. Create escalation rules that ensure everyone follows the process and nothing is left to chance.

Question has a verified solution.

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

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

691 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