[dba-SQLServer] Support for Filter clause?

Arthur Fuller fuller.artful at gmail.com
Tue Jan 26 14:05:23 CST 2016


The SQL standard and Postgres support the FILTER clause, as in:

SELECT

  COUNT(*) FILTER (WHERE sal < 10000)

      AS test1,

  COUNT(*) FILTER (WHERE dept > 10)

      AS test2,

  COUNT(*) FILTER (WHERE hiredate > (SYSDATE - 60))

      AS test3,

  COUNT(*) FILTER (WHERE grade = 1)

      AS test4

FROM employees;


The latest version of MS-SQL I have installed is 2012. Does anyone
using something more recent know if the syntax above is supported?


-- 
Arthur


More information about the dba-SQLServer mailing list