0
是否有任何其他方式来编写此查询,以便它不会得到错误?如何处理返回多个值错误的子查询?
select sum(Travelled_value)
from travel_table
where customer_id=(select distinct f.CUSTOMER_ID as agg
from SEGMENT_table f
JOIN bookin_table t
ON f.CUSTOMER_ID=t.CUSTOMER_ID
where t.booking_date BETWEEN sysdate
AND sysdate+21 and f.type='NEW';)
这里有三个表,其中customer_id是通用的。
编辑您的问题并显示错误。 –
也许你想'IN'子查询,而不是'='子查询。 – jarlh
用'where customer_id in'替换'where customer_id =' – dasblinkenlight