Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: SQL ?
Thanks D.
I thought about doing a Union on it but thought performance would be a disaster. As it turns out, it works great.
I did similar to what you suggested but I put Salary and Salary_hist into 1 table:
select id,site,name,pay_date
from
employee,
(select sal_id ID, sal_site SITE, pay_date from salary
union
select sal_h_id ID, sal_h_site SITE, pay_date from salary_hist) Salary
where
employee.id = Salary.id
and
employee.site = Salary.site
and
Salary.pay_date >= <some date>
and
Salary.pay_date <= <some date>
/
The performance rocks.
Anyway. Thanks for the heads up on this one. Sometimes I just get stuck
on something
and all I need is a hint. (in your case, I got the whole query...hehe)
Regards,
Eric
DStevens wrote:
> Select Sal_ID , Sal_Site , Pay_Date, Name
> From Salary S, Employee E
> Where S.Sal_id = E.ID
> UNION
> Select Sal_h_ID , Sal_h_Site , Pay_Date, Name
> From Salary_Hist S1, Employee E
> Where S1.Sal_h_ID = E.ID
Received on Tue Dec 11 2001 - 15:01:57 CST