Thread: Join Query Help

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Posts
    17
    Rep Power
    0

    Post Join Query Help


    I have Two Tables in Postgres Database,
    I need a Join Query to access those tables.

    TableA

    orgid varchar
    orgname varchar

    TableB

    branchid varchar
    branchname varchar
    orgid varchar
    orgname varchar


    I want to display all the records in TableA where TableA orgid is not exists in TableB. I have Some 500 Records in TableA and 1000 in TableB.

    Thanks
  2. #2
  3. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,212
    Rep Power
    4279
    Code:
    select TableA.orgid
         , TableA.orgname  
      from TableA
    left outer
      join TableB
        on TableA.orgid = TableB.orgid
     where TableB.orgid is null

    rudy

IMN logo majestic logo threadwatch logo seochat tools logo