is there any way to perform a query that returns 1...
# squarelibraries
m
is there any way to perform a query that returns 1 or 0, but parse it as boolean in the generated model ?
b
define the field as "INTEGER AS BOOL" and all the query will use booleans
m
i’m not talking about table definition, that it works. I’m talking about the result of a query, not directly associated with the boolean column. And that result is an int, but i want to parses to think it as a boolean. The real question probably, you cannot use ‘AS BOOL’ in queries can you ?
SELECT 1 AS BOOL (thats what i was asking). Because i know if you do ‘SELECT boolColumns FROM xxxx’ it works
a
does it work if you do
SELECT integerColumn = 1 FROM ...
?
I've used
COUNT(*) > 0
in the past and it worked as expected (returns a boolean)
m
good point. I’ll check later. Thanks!
❤️ 1