Results 1 to 3 of 3

Thread: updateing the record with mapping different column

  1. #1
    Junior Member
    Join Date
    May 2008
    Answers
    9

    updateing the record with mapping different column

    i need to update the record in table line .but i have to map the specific line record using line_esn ,account,company_number_loc .but in update we can pass only one table like update "tablename".
    How could i do that.......


    update line_esn le, line l, account a, company_number_location cnl
    set l.pin =8351
    where le.line_id = l.line_id
    and le.mdn = '4042108351'
    and le.esn = '09900311161'
    and cnl.company_cd = 'REVASDATA'
    and a.number_loc = cnl.number_loc
    and a.account_id = l.account_id


  2. #2
    Expert Member
    Join Date
    Sep 2007
    Answers
    697

    Re: updateing the record with mapping different column

    You can't specify more than one table name in update.

    Do it in the following way

    UPDATE line l
    SET l.pin = 8351
    WHERE l.line_id = ( SELECT line_id from line_esl le
    WHERE le.line_id = l.line_id
    AND le.mdn = '4042108351'
    AND le.esn = '09900311161' )
    and l.account_id = (SELECT a.account_id from account a , company_number_location cnl
    WHERE a.account_id = l.account_id
    AND a.number_loc = cnl.number_loc
    and cnl.company_cd = 'REVASDATA')


  3. #3
    Junior Member
    Join Date
    Oct 2007
    Answers
    3

    Re: updateing the record with mapping different column

    Have your tried this

    UPDATE l
    SET l.pin = 8351
    FROM line l
    join line_esl le on le.line_id = l.line_id AND le.mdn = '4042108351' AND le.esn = '09900311161'
    join account a on a.account_id = l.account_id AND a.number_loc = cnl.number_loc and cnl.company_cd = 'REVASDATA'

    Regards
    AM


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact