Sqlite ON statement on calculated field failing

73 views Asked by At

I'm trying the following query with no luck:

SELECT B.id AS BookId, P.id AS PdfId FROM tbl_Books AS B
INNER JOIN tbl_PDF AS P ON P.FileName = B.ShortName || '.pdf'
COLLATE NOCASE

Is in Sqlite possible to use a clause in ON statement?

Thanks

1

There are 1 answers

2
Anton Gogolev On

I think what you need is coalesce(b.ShortName, '.pdf'). Be aware, though, that it will return empty string if b.ShortName is an empty string (as opposed to null).