【发布时间】:2018-06-04 16:36:31
【问题描述】:
我想在下面的查询中更改数组列 call_type 的条件,以便它排除所有具有“访问发生”的内容。
我如何使用该数组部分?
select staff_id,
COUNT(event_id) as offered
from call_logs as logs
where visit_offered
and contact_date between now() - interval '1 weeks' and now()
and provider_type = 'Contractor'
and contact_with != 'company_staff'
and direction = 'outbound'
and outcome = 'Successful'
and call_type && array ['Schedule','schedule_visit']
group by staff_id;
【问题讨论】:
-
"排除所有有 'visit_occurred'" 有点模糊。您想完全匹配数组元素还是识别包含给定字符串的元素?请始终公开您的 Postgres 版本。
标签: sql arrays postgresql