Results 1 to 7 of 7
  1. #1
    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

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,629
    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.
    Last edited by anacedent; 01-21-13 at 10:25.
    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.
    There are no stupid questions, but there are a LOT of Inquisitive Idiots.

  3. #3
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,629
    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.
    There are no stupid questions, but there are a LOT of Inquisitive Idiots.

  4. #4
    Join Date
    Jan 2013
    Posts
    4
    and rownum?

  5. #5
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,629
    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.
    There are no stupid questions, but there are a LOT of Inquisitive Idiots.

  6. #6
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,629
    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.
    There are no stupid questions, but there are a LOT of Inquisitive Idiots.

  7. #7
    Join Date
    Jan 2013
    Posts
    306
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •