Solved

Search field and replace two others

Posted on 2013-11-27
3
231 Views
Last Modified: 2013-11-27
This may be simple to all but just cant get my head around :(

I would like to search for a value in FA_COST_NOM and if found replace the values in both FA_DISP_NOM and FA_REVAL_NOM, all three fields are in the same FA_ACCOUNTS table.

i.e.

FA_COST_NOM    FA_DISP_NOM    FA_REVAL_NOM
11980                   11960                  11950

If 11980 is found change the other two fields to 11960 and 11950 respectively. There may be multiple records with 11980 in them.

Please help.
Regards
S
0
Comment
Question by:SimonJohnG
  • 2
3 Comments
 
LVL 17

Accepted Solution

by:
Chris Millard earned 500 total points
ID: 39680425
I'm on holiday at the moment, so don't have access to SQL, but something like:-

UPDATE FA_ACCOUNTS
SET FA_DISP_NOM = '11960', FA_REVAL_NOM = '11950'
WHERE FA_COST_NOM = '11980'

Open in new window

0
 

Author Closing Comment

by:SimonJohnG
ID: 39680455
Thank you so much, easy when you know how! Hopefully didnt take up too much of your holiday, anywhere nice?
S
0
 
LVL 17

Expert Comment

by:Chris Millard
ID: 39680475
:-) Indoors - trying to use up holiday allocation rather than losing it!
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now