Home » RDBMS Server » Server Administration » Re: Select a.x ,b from (select x) a, b question.
Re: Select a.x ,b from (select x) a, b question. [message #373682] Tue, 01 May 2001 14:47 Go to next message
Andrew again...
Messages: 270
Registered: July 2000
Senior Member
No, for a correlated subquery you need to have something similar to this form:
SELECT e.name, b1.no_insurance
FROM emp e, b b1
where (b1.id, b1.insurance_no) in
(SELECT b2.id, b2.no_insurance
FROM b b2
WHERE b2.id = emp.id
AND ROWNUM = 1)

Be careful about your "rownum = 1" this raises concerns that there is some missing logic. That condition will not consistently return the same sesult as there is no logic to distinguish between duplicates. Consider adding a further condition to select max(b1.id) or include some other condition to restrict to one row in the sub query.
Re: Select a.x ,b from (select x) a, b question. [message #373684 is a reply to message #373682] Tue, 01 May 2001 14:51 Go to previous message
Steve V.
Messages: 1
Registered: May 2001
Junior Member
Thanks Andrew for the answer ...
Previous Topic: Re: how do you see all the tables in Oracle8 ?
Next Topic: Re: Select a.x ,b from (select x) a, b question.
Goto Forum:
  


Current Time: Mon Dec 23 08:30:47 CST 2024