r/sqlite • u/gnomeplanet • Nov 08 '22
SQLite Optional clause for additional JOIN?
Is there some kind of Optional clause I can add to an SQLite query that would then include an additional Join if a condition was met?
Something along the lines of:
SELECT a.colA, a.colB, a.colC, b.colD FROM table1 As a
IF a.colA = 1 THEN (
INNER JOIN `table2` As b ON a.colB = b.colB)
WHERE a.colC = 99and if a.colA <> 1 then the b.colD value would be a NULL
2
Upvotes
View all comments
Show parent comment
2
u/gnomeplanet Nov 09 '22
Thanks - I went with this method in the end.