r/PostgreSQL•
notooth1

Help me fix this query

Hello,

Can anyone help me fix this query:

  WITH abc AS (
      IF (SELECT COUNT(*) FROM table1) > 0 THEN
	      SELECT * FROM table2
      ELSE
	      SELECT * FROM table3
      END IF
  )
  SELECT * FROM abc;

Posted Aug 29, 2016, 11:22 PM UTC

13
Loading comments…