【发布时间】:2012-11-05 06:08:54
【问题描述】:
select a.subscriber_msisdn, war.created_datetime from
(
select distinct subscriber_msisdn from wiz_application_response
where application_item_id in
(select id from wiz_application_item where application_id=155)
and created_datetime between '2012-10-07 00:00' and '2012-11-15 00:00:54'
) a
left outer join wiz_application_response war on (war.subscriber_msisdn=a.subscriber_msisdn)
子选择返回 11 行,但加入时返回 18(有重复项)。此查询的目标只是将日期列添加到子选择的 11 行中。
【问题讨论】:
-
我没有看到表定义、示例数据或 PostgreSQL 版本。
标签: postgresql join duplicates distinct subquery