From: Faye on
This is my data. Salesman is the key. I want to select them and then
change them to another Salesman.

From
Salesman Customer
25 Jeff
25 Kory
25 Jean

To
Salesman Customer
30 Jeff
30 Kory
30 Jean


How do I do that? Thanks.

Faye
From: Plamen Ratchev on
Not sure what you need, but try this (make sure to try on test data not directly on production):

UPDATE Tables
SET salesman = 30
WHERE salesman = 25
AND customer IN ('Jeff', 'Kory', 'Jean');

If you need to update all customers, then this:

UPDATE Tables
SET salesman = 30
WHERE salesman = 25;

--
Plamen Ratchev
http://www.SQLStudio.com
From: Faye on
salesman is the primary key. It can not be updated.



On Apr 15, 5:00 pm, Plamen Ratchev <Pla...(a)SQLStudio.com> wrote:
> Not sure what you need, but try this (make sure to try on test data not directly on production):
>
> UPDATE Tables
> SET salesman = 30
> WHERE salesman = 25
>    AND customer IN ('Jeff', 'Kory', 'Jean');
>
> If you need to update all customers, then this:
>
> UPDATE Tables
> SET salesman = 30
> WHERE salesman = 25;
>
> --
> Plamen Ratchevhttp://www.SQLStudio.com

From: Plamen Ratchev on
Then I do not understand what you are trying to do. First you describe you want to change the salesman, and then that it
cannot be changed. Using DELETE and INSERT will have the same effect as UPDATE, not sure how you really need this changed.

--
Plamen Ratchev
http://www.SQLStudio.com
From: Faye on
I was looking for options like creating a temporary table and insert
the new rows and delete the original rows using script... Wonder what
other options are available.



On Apr 16, 8:22 am, Plamen Ratchev <Pla...(a)SQLStudio.com> wrote:
> Then I do not understand what you are trying to do. First you describe you want to change the salesman, and then that it
> cannot be changed. Using DELETE and INSERT will have the same effect as UPDATE, not sure how you really need this changed.
>
> --
> Plamen Ratchevhttp://www.SQLStudio.com