Menu
I’ve got a JOIN in my SQL which joined a location ID to a location row.
SELECT locationId FROM tableB b
JOIN tableA a ON a.locationId = b.locationId
However if locationb is not set I want set to to a default value
SELECT IF (b.locationId = 0, 2, a.location) FROM tableB
JOIN tableA a ON b.locationId = IF (g.venueId = 0, 2, g.venueId)
It’s messy but if my table B location ID is 0 I want to force in a value.