I have the following sql statement that is joining 3 tables..
SELECT A.category, A.ssn, A.categoryText, B.summary, B.form, C.regNr, C.account
FROM tableA A
JOIN tableB B ON A.category = B.category
JOIN tableC C ON A.ssn = C.ssn
WHERE B.form = 0
I’m getting the error
Invalid column name 'ssn' (line 1)
But when I join tableA and tableB only like this:
SELECT A.category, A.ssn, A.categoryText, B.summary, B.form--, C.regNr, C.account
FROM tableA A
JOIN tableB B ON A.category = B.category
--JOIN tableC C ON A.ssn = C.ssn
WHERE B.form = 0
then I get no error at all!
What am I doing wrong?
tia
I’m assuming your schema for table C does actually include the ssn column & it’s spelled correctly (i.e. you don’t have a typo causing the issue).
Depending on DB platform the other things to look at are whether the collation in use on your DB is causing a failure due to a mis-match on case sensitivity. E.g. is the column called ‘SSN’ in table c rather than ‘ssn’?