NULL as a condition for SQL query through Lua?

,

I’m trying to fetch a table of cars that have no job assigned - (NULL). But I’m using it wrong, because it doesn’t load any. Something like

WHERE job = @job
['@job'] = NULL,

alternatively

['@job'] ~= police

I was trying to google solution for this, but nothing with calling the null string via Lua. Would anyone know how to do it?

Make your DB API support a DBNull-like sentinel type for such. Lua tables can’t contain nil.

1 Like