Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

postgresql filter on

SELECT COUNT(*) AS [column_name],
COUNT(*) FILTER (WHERE {column_name}{comparison_operator}{VALUE} ) 
   AS [column_name]
FROM TABLE_NAME;
# e.g. 
SELECT COUNT(*) AS no_filter,
COUNT(*) FILTER (WHERE id < 6 ) AS with_filter
FROM employee;
Source by kb.objectrocket.com #
 
PREVIOUS NEXT
Tagged: #postgresql #filter
ADD COMMENT
Topic
Name
9+1 =