Results 1 to 2 of 2

Thread: query help

  1. #1
    Join Date
    Feb 2006
    Posts
    59

    Arrow Unanswered: query help

    hello

    i have a problem
    i have a clients table in which id card numbers are stored along with other information. few months a go computerized id cards were introduced and all clients were asked to update there id cards to the new ones. now most of them did but there were still 500 records left . what i did was collected the records in excel format and loaded them into a table par with sqlldr. my query was
    update client c set c.id_card_number=(select p.id_card_number from par p where p.client_code=c.client_code)

    this query updated all the rows .. inserted the id cards with their respective codes in the clients table but what it did worse was that it removed the previous record of id cards or placed a null value in the field.

    some how i managed the clients table back to its original form .. now i am stuck how can i update only those 500 records which are in the par table instead of uploading all the 7000 records

    plz help

  2. #2
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    Code:
     update client c 
    set c.id_card_number=(select p.id_card_number 
                                   from par p 
                                  where p.client_code=c.client_code)
    where c.client_code in 
    (select x.client_code 
     from par x );
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

Posting Permissions

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