TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
G F
NA
44
6.6k
SQL Error when attempting to create a three Table Join state
Feb 27 2020 6:36 PM
Hi,
I would like to create a MySQL Select Statement,using Joins to join 3 tables.
Currently in my Code, I have the two Table join working great:
SELECT
traveldocuments.TDNumber,
traveldocuments.TDMoveStart,
traveldocuments.TD_ODR_O_Address,
traveldocuments.TD_ODR_D_Address,
approvals.ApprovalJurisdictionFee,
approvals.ApprovalPermitFee
FROM
traveldocuments
Left
JOIN
approvals
ON
(traveldocuments.Id=approvals.TDId);
So I was doing some searching, and I can see examples from other languages (Java), that I should be able to just add on the third table, but it errors out (not in code but in the DBMS), this is what I tried to change it to:
SELECT
traveldocuments.TDNumber,
traveldocuments.TDMoveStart,
traveldocuments.TD_ODR_O_Address,
traveldocuments.TD_ODR_D_Address,
approvals.ApprovalJurisdictionFee,
approvals.ApprovalPermitNowFee,
commodities.CommoditySteerUnitNumber
FROM
traveldocuments
Left
JOIN
approvals
ON
(traveldocuments.Id=approvals.TDId);
LEFT
JOIN
commodities
ON
(traveldocuments.Id=commodities.TDId);
The specific error is Unknown column : 'commodities.CommoditySeerUnitNumber' in 'field list'
I know this table and column exist, when I'm building the statement in HeidiSQL, it autocompletes the column name, and I've printed out my table columns and I can see it there.
I have a Foreign Key in the commodities table setup exactly the same way as the approvals table, it's almost like a parent/child setup.
Any suggestions would be appreciated.
Thank you!
Reply
Answers (
3
)
Exact Difference between nvarchar and varchar data type.
What is difference between Primary Key and Unique Key in SQL