Boolean projection

Is there a way to project a calculated boolean value? For example, the simplest case:

select 1, true

works fine, returning two columns with the values 1 and true. But:

select 1, (1==2)

does not work. This is just an example, I need (1==2) to be a more complex boolean expression depending on a query.

Hi,

it may be not what are you looking for but, try this:


RETURN FALSE:

select if(eval("1 = 2"), true, false)

+----+------------------------------+
|#   |if(eval("1 = 2"), true, false)|
+----+------------------------------+
|0   |false                         |
+----+------------------------------+

RETURN TRUE:

select if(eval("1 = 1"), true, false)

+----+------------------------------+
|#   |if(eval("1 = 1"), true, false)|
+----+------------------------------+
|0   |true                          |
+----+------------------------------+

Hope it helps.

Regards,
MIchela

1 Like

This could help. Thanks!