Skip to content

Instantly share code, notes, and snippets.

@abelcallejo
Last active June 26, 2018 03:36
Show Gist options
  • Save abelcallejo/dab61f4fceeab25ef9bcb4788d262851 to your computer and use it in GitHub Desktop.
Save abelcallejo/dab61f4fceeab25ef9bcb4788d262851 to your computer and use it in GitHub Desktop.
intval
/**
* This is how you intval in PostgreSQL
**/
SELECT cast( coalesce( nullif( column_name_here, 0 ), '0') as integer ) AS column_name_alias_here FROM table_name_here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment