在Oracle中,FILTER函数的语法如下:
FILTER (aggregate_function(expression), WHERE condition)参数说明:
aggregate_function(expression):可以是任何聚合函数,如SUM、AVG、COUNT等。WHERE condition:指定要筛选的数据行。例如,使用FILTER函数计算销售订单中已完成的订单数量:
SELECT COUNT(order_id) FILTER(WHERE status = 'Completed') AS completed_ordersFROM orders; 

