Geeks Talk

Prepare for your Next Interview




updateing the record with mapping different column

This is a discussion on updateing the record with mapping different column within the SQL forums, part of the Databases category; 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 ...


Go Back   Geeks Talk > Databases > SQL

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 05-22-2008
Junior Member
 
Join Date: May 2008
Posts: 12
Thanks: 3
Thanked 1 Time in 1 Post
AnjaliWatane is on a distinguished road
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
Reply With Quote
The Following User Says Thank You to AnjaliWatane For This Useful Post:
Sponsored Links
  #2 (permalink)  
Old 05-23-2008
Expert Member
 
Join Date: Sep 2007
Posts: 754
Thanks: 22
Thanked 62 Times in 61 Posts
krishnaindia2007 is on a distinguished road
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')
Reply With Quote
The Following User Says Thank You to krishnaindia2007 For This Useful Post:
  #3 (permalink)  
Old 05-28-2008
Junior Member
 
Join Date: Oct 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
AM_GEEK is on a distinguished road
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
Reply With Quote
Reply

  Geeks Talk > Databases > SQL


Thread Tools
Display Modes


Similar Threads

Thread Thread Starter Forum Replies Last Post
mapping spandana_it Data Warehousing 1 09-12-2007 05:27 AM
XML Object Mapping garg_me Data Warehousing 2 09-07-2007 11:22 AM
How can we upload job after mapping? selvaraj.durairaj Data Warehousing 1 08-24-2007 08:11 AM
Mapping and Auxiliary Mapping? sanghala Data Warehousing 0 08-21-2007 05:25 AM
Record GUI Script and Record Session icons are always disabled Geek_Guest Rational Robot 1 06-01-2007 08:01 AM


All times are GMT -4. The time now is 06:40 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 GeekInterview.com. All Rights Reserved