Whats wrong with this query?I'm trying to run on redshift but i'm getting the erro could not devise a query plan for the given query .
The 2 tables have filenames and I wish to discover which files they share and which they dont(I need to know which one has the file in this case). In case they share, the filename would appear on both columns, in case they dont share, the filename would appear only on the column of the table that has it while the other column would be null/empty. There are rows with the same filename so thats why I used distinct. I used substring to ignore the extension.
select distinct a.filename as arquivo_a , r.filename as arquivo_r
from table1 a
FULL JOIN table2 r ON SUBSTRING(a.filename,1,LEN(a.filename) - 4) = SUBSTRING(r.filename,1,LEN(r.filename) - 4)