代表。我有这个查询
select distinct t1.date1, t2.date2
from t1
join t2 ...
....
where ...
我希望得到这2个日期的唯一值列表。我怎么能在Firebird 2.5上做到这一点?
我试试这个
with dates as (
select t1.date1 d1, t2.date2 d2
from t1
join t2 ...
....
where ...)
select d1 from dates
union
select d2 from dates
但是这个版本会使性能降低两倍
答案 0 :(得分:1)
试试这个:
with dates (dt) as (
select t1.date1 from t1
where (1=1) --conditions
union
select t2.date2 from t2
where (1=1) --conditions
)
select unique dt
from dates