No such column error when column does exist

401 views Asked by At

I have three tables: nanoProd, nanoFiles, and nanoRelFiles. Third table is used to store the file meta and how they relate to other screens.

I'm getting an error that a column doesn't exist when I know it does and I'm not sure why:

no such column: nanoFiles.fileLoc: 
SELECT 
prodTable.name AS prodName,
prodTable.intro AS prodIntro,
prodTable.prodText AS nanoText,
nanoFiles.fileLoc AS nanoFile
FROM nanoProd AS prodTable
LEFT JOIN nanoRelFiles on nanoFiles.rid = nanoRelFiles.file_id
LEFT JOIN nanoProd ON nanoProd.rid = nanoRelFiles.item_id
WHERE nanoRelFiles.scr_type = 'prod' AND nanoRelFiles.fileUse = 'list'
1

There are 1 answers

0
Chris Stillwell On BEST ANSWER

You aren't joining to any table called "nanoFiles." You need to JOIN to that table to be able to SELECT from that column. Something like this:

FROM nanoProd AS prodTable
JOIN nanoFiles on ...
LEFT JOIN nanoRelFiles on nanoFiles.rid = nanoRelFiles.file_id