Topic: What is behind the internal query of the boolean column?

Hi Dmitry,

what is the SQL query behind the native MVDB engine to display "Yes" or "No" on Boolean column.

I had to write a specific query for multisearch field and instead of getting "Yes" or "No", I got "0" or "1". Is it a case() ?

Re: What is behind the internal query of the boolean column?

Hello,


To store boolean values in database used integer values like 0 = No, 1 = Yes
If you want return Yes or No from database instead  0 or 1, you should use sql query like that:


SELECT 
field1, 
field2, 
(CASE BoolField WHEN 1 THEN 'Yes' WHEN 0 THEN 'No' ELSE '' END),
field3

FROM tablename

'Yes' and 'No' you can replace on any other words.

Dmitry.

Re: What is behind the internal query of the boolean column?

Ok, thanks Dmitry, I was pretty sure about the use of case.