If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Oracle > Basic Join with Rowid

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old
Registered User
 
Join Date: Jan 2013
Posts: 4
Basic Join with Rowid

Hi,

I have got a basic question but in my database it will not work.

I have two tables. Both have the similar amount of rows. I want to add one column of the first table into the second table. Here, the values should be in the same order as before. Table1.row1 = Table2.row1; Table1.row2 = Table2.row2 ; Table1.row3 = Table2.row3....Table1.row(n) = Table2.row(n).

The issue is, there is no really connector for a join. I tried with rowid, but no selected row is presented. (permanently is the column I will add)

Code:
SElECT tab.rowid rid
nvl(permanently2, permanently) permanently,
tab2.rowid bum
    from  tab,
            tab2
                 where tab.rowid= tab1.rowid;
Thanks
Reply With Quote
  #2 (permalink)  
Old
Registered User
 
Join Date: Aug 2003
Location: Where the Surf Meets the Turf @Del Mar, CA
Posts: 7,598
rows in a tables are like balls in a basket.
rows in a table have NO inherent order!

which ball in a basket is the "first" ball?
which ball in a basket is the "next" ball?

Simply put the "requirement" makes no sense.
__________________
You can lead some folks to knowledge, but you can not make them think.
The average person thinks he's above average!
For most folks, they don't know, what they don't know.
Don't say, show. Don't promise, prove.

Last edited by anacedent; 01-21-13 at 10:25.
Reply With Quote
  #3 (permalink)  
Old
Registered User
 
Join Date: Aug 2003
Location: Where the Surf Meets the Turf @Del Mar, CA
Posts: 7,598
ROWID Pseudocolumn

rowid are guaranteed to be unique & therefore can NEVER be equal to another rowid.
__________________
You can lead some folks to knowledge, but you can not make them think.
The average person thinks he's above average!
For most folks, they don't know, what they don't know.
Don't say, show. Don't promise, prove.
Reply With Quote
  #4 (permalink)  
Old
Registered User
 
Join Date: Jan 2013
Posts: 4
and rownum?
Reply With Quote
  #5 (permalink)  
Old
Registered User
 
Join Date: Aug 2003
Location: Where the Surf Meets the Turf @Del Mar, CA
Posts: 7,598
how many columns in TABLE1?
how many columns in TABLE2?

what happens when TABLE1 & TABLE2 have different number of rows?
__________________
You can lead some folks to knowledge, but you can not make them think.
The average person thinks he's above average!
For most folks, they don't know, what they don't know.
Don't say, show. Don't promise, prove.
Reply With Quote
  #6 (permalink)  
Old
Registered User
 
Join Date: Aug 2003
Location: Where the Surf Meets the Turf @Del Mar, CA
Posts: 7,598
Quote:
Originally Posted by marcopo View Post
and rownum?

what about rownum?

SELECT * FROM TABLE1 ORDER BY COLUMN1;

does query above have same "first row" (ROWNUM=1) as query below?

SELECT * FROM TABLE1 ORDER BY COLUMN2;


so exactly which row is "first row" from TABLE1?
__________________
You can lead some folks to knowledge, but you can not make them think.
The average person thinks he's above average!
For most folks, they don't know, what they don't know.
Don't say, show. Don't promise, prove.
Reply With Quote
  #7 (permalink)  
Old
Registered User
 
Join Date: Jan 2013
Posts: 298
Quote:
Originally Posted by marcopo View Post
and rownum?
It is how non-RDBMS programmers mimic a 1950's magnetic tape. Their mindsets cannot handle abstractions like keys, sets, data types, etc. They live in a world of punch cards and physical files.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On