how to count records and change to a boolean in postgresql code example Example: postgres count where true SELECT count(CASE WHEN myCol THEN 1 END) FROM <table name>