Home » RDBMS Server » Server Administration » I want to join two tables by row number, how do I do this?
I want to join two tables by row number, how do I do this? [message #372622] Wed, 28 February 2001 15:43 Go to next message
Dean
Messages: 34
Registered: August 2000
Member
I just want to paste the two tables side by side where a.rownum = b.rownum. Is there a way to do this? Both tables have the same number of records.
Re: I want to join two tables by row number, how do I do this? [message #372623 is a reply to message #372622] Wed, 28 February 2001 16:20 Go to previous message
Madhav Kasojjala
Messages: 42
Registered: November 2000
Member
Hi Dean,
here's how you can do

You need to get rownums first to do this job and hence Select has to be executed so that the SQL Area has rownums indexed by Oracle Engine.
So
Select a.*, b.*
from
(select rownum sno_a, col1,col2.... from table_1 where .....) a,
(select rownum sno_b, col1,col2.... from table_1
where.....) b
where a.sno_a = b.sno_b
will work as you have already 2 result sets created through in-line views coming from "from clause".
Hope that helps
Madhav
Previous Topic: can I read in an sql record key only?
Next Topic: how to select picture from a table?
Goto Forum:
  


Current Time: Sat Jun 29 08:28:17 CDT 2024