Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I convert boolean into 0 and 1 in Redshift?

I guess I can do something like case when field then 1 else 0 end. But is that the only way?

like image 717
Junyu Yang Avatar asked Sep 04 '25 03:09

Junyu Yang


1 Answers

select cast(b as integer)

or

select convert (integer, b) 
like image 120
Chris H Avatar answered Sep 06 '25 21:09

Chris H