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
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')
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