Skip to content
Advertisement

Tag: postgresql

Unterminated dollar quote

How to use IF statement in the PostgreSql (11 version)? I tried just raw IF usage but got problem (syntax error at or near “IF”). To resolve this problem people propose to use ‘do &&’ but it does not work as well (Unterminated dollar quote started at position 3 in SQL DO $$ BEGIN IF ……). Here is my SQL

Count sum of two columns

I am trying to count the sum of 2 columns from a subset of results, so far I have put this together SELECT COUNT(*) FROM table_name WHERE column_1 + column_2 >= 3 IN (SELECT id …

Advertisement