Hello all,
I would like to do a SQL command to change all records in a table, that has the same data. In this case it would be a number. That number would be changed.
Can anyone please suggest the SQL Command to do this?
Thank you!
Tim
Hello all,
I would like to do a SQL command to change all records in a table, that has the same data. In this case it would be a number. That number would be changed.
Can anyone please suggest the SQL Command to do this?
Thank you!
Tim
Something like:
UPDATE
my_table
SET
the_field = new_value
WHERE
the_field = old_value
Without more information about the structure of your database, I can only provide this generality.
Thanks Kem,
Here is the stucture, I need to change the field mfa_code
Tim
CREATE TABLE units_accounts
(
rowid bigserial NOT NULL,
unit_id text NOT NULL,
prim_account_no bigint,
account_no bigint NOT NULL,
access_code bigint,
fname text,
lname text,
business_name text,
prox_id bigint,
isprimary text,
future_active_date text,
axcys_request_pin bigint,
axcys_request_start_datetime character(20),
axcys_request_exp_datetime character(20),
nrc text DEFAULT ‘N’::bpchar,
sap text DEFAULT ‘N’::bpchar,
mfa_code bigint,
CONSTRAINT units_accounts_pkey PRIMARY KEY (rowid)
UPDATE
units_accounts
SET
mfa_code = new_value
WHERE
mfa_code = old_value
Thank you Kem,
Looks so easy, much appreciate the help!
Tim
You could google for something like “sql change all records with a particular value in a column to another value in the same column”.
That works perfectly -
Thank you again Kem
Tim
ForumGPT is also very good at it.