Left join without condition

  • Hi,

    I have two tables. Table_A and Table_B.

    I have the folowing records in Table_A

    ID COURSE ST FT WK Faculty

    ---------------------------------------

    111 VVV 10:00 12:00 2 4521216

    111 VVV 10:00 12:00 4 4521216

    111 VVV 1100 12:00 3 2323233

    111 VVV 1100 12:00 1 4521216

    I have the folowing records in Table_B

    ID COURSE ST FT WK Faculty

    ---------------------------------------

    111 VVV 10:00 12:00 2 4521216

    111 VVV 10:00 12:00 4 4521216

    111 VVV 1100 12:00 3 2323233

    I have four records in table A and 3 in table B,

    Originally in the table there are 5439 rows in Table A and 5223 in Table B. That means I need to get the missing record from Table A..

    How can I get that. I am trying a LEFT OUTER JOIN and it gives me all the values where a.id=b.id.

    But as u see... how can I capture that 4th record in Table A which is not there in Table _B

    The is really urgent. Will appreciate kind help. Thanks

  • Please post your query.

  • Are the two tables supposed to be exact duplicates? (If so, be sure you really need two tables.)

    If so, then you might just truncate table B and insert everything from table A into it.

    Alternately, you could use the Except function to fill them in.

    insert into tableB

    select *

    from tableA

    except

    select *

    from tableB

    insert into tableA

    select *

    from tableB

    except

    select *

    from tableA

    Something like that will make the two tables into exact duplicates of each other, assuming they have the same columns (as your post implies).

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply