Fix SQL for sqlite and mysql, FALSE on postgresql but 0 on mysql/sqlite