ibozc
asked on
SQL INNER JOIN syntax error.
I have this SQL query that does not execute because there is a problem in it. I cannot see a syntax issue with it. If you can please help. Thank you.
SELECT B.*, S.*, M.[File Closing Date]
FROM BoxNumbers AS B INNER JOIN StorageBoxesTable AS S ON B.IronMountain = S.newboxnumber
INNER JOIN MasterFileList AS M ON S.FileNumber = M.[File Number]
WHERE ((S.OldBoxNumber)<>(B.OldR ecall));
SELECT B.*, S.*, M.[File Closing Date]
FROM BoxNumbers AS B INNER JOIN StorageBoxesTable AS S ON B.IronMountain = S.newboxnumber
INNER JOIN MasterFileList AS M ON S.FileNumber = M.[File Number]
WHERE ((S.OldBoxNumber)<>(B.OldR
ASKER
Syntax Error (missing operator) in query expressions B.IronMountain = S.newboxnumber
INNER JOIN MasterFileList AS M ON S.FileNumber = M.[File Number]
INNER JOIN MasterFileList AS M ON S.FileNumber = M.[File Number]
M.[File Number] could be wrong. Check your column name, whether it have space inbetween. It may be M.FileNumber
»Raj
»Raj
Same applies for M.[File Closing Date]
»Raj
»Raj
ASKER
they are correct.
ASKER
I may add that B.IronMountain, S.FileNumber and S.newboxnumber may have multiple entries and only M.[File Number] is unique. Would that make any difference?
How about the extra parentheses in your where?
SELECT B.*, S.*, M.[File Closing Date]
FROM BoxNumbers AS B INNER JOIN StorageBoxesTable AS S ON B.IronMountain = S.newboxnumber
INNER JOIN MasterFileList AS M ON S.FileNumber = M.[File Number]
WHERE (S.OldBoxNumber<>B.OldReca ll);
SELECT B.*, S.*, M.[File Closing Date]
FROM BoxNumbers AS B INNER JOIN StorageBoxesTable AS S ON B.IronMountain = S.newboxnumber
INNER JOIN MasterFileList AS M ON S.FileNumber = M.[File Number]
WHERE (S.OldBoxNumber<>B.OldReca
>>> I may add that B.IronMountain, S.FileNumber and S.newboxnumber may have multiple entries and only M.[File Number] is unique. Would that make any difference?
No, that would just produce a larger result set.
-G
No, that would just produce a larger result set.
-G
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Are these tables or views? If view, maybe an error in the view?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you guys, that last one worked perfectly.
-G