I have two tables that I need data from.
The table1 has a field that has a number in it (InComment is the field name). The number in the InComment field is the key in table2. I need to select all the data in table1, then pull in the field in the other table that corresponds to the value in the comment field in table1.
For example.
Table1(Machines ) InComment value = 34
Table2(Comments ) CommentID = 34
Table2(Comments ) Comment = "Comment Text"
I know this is some sort of join, but I have no clue how to get it to work. Below is what I am trying, that returns nothing:
The table1 has a field that has a number in it (InComment is the field name). The number in the InComment field is the key in table2. I need to select all the data in table1, then pull in the field in the other table that corresponds to the value in the comment field in table1.
For example.
Table1(Machines ) InComment value = 34
Table2(Comments ) CommentID = 34
Table2(Comments ) Comment = "Comment Text"
I know this is some sort of join, but I have no clue how to get it to work. Below is what I am trying, that returns nothing:
Code:
SELECT Machines.MachineID, Machines.LoadID, Machines.AssetNum, Machines.SerialNum, Machines.ModelNum, Machines.InComment, Machines.MachineLoadNum, Machines.MachineSalesOrderNum, Comments.CommentID, Comments.Comment FROM Machines LEFT JOIN Comments ON Machines.InComment = Comments.CommentID WHERE (((Machines.LoadID)=1993) AND ((Machines.MachineSalesOrderNum) Like 'BRP553%'));
Comment