是否可以查询字段,整数数组,并根据current_date返回一个Dates数组 - 一个int值。
我的数据结构类似于
_Category_
name:string
send_reminders:array[integer]
_Appointment_
category_id:integer
title:string
event_date:date
_Customer_
appointemtn_id:integer
name:string
contact:boolean
我想查询在该日期有约会提醒的客户。
我认为我可以做到这一点答案 0 :(得分:2)
select *
from
category cat
inner join
appointment ap on cat.category_id = ap.category_id
inner join
customer ct on ct.appointment_id = ap.appointment_id
where
ap.event_date in (
select current_date - i
from unnest(cat.send_reminders) u (i)
)
and ct.contact