I have a table i need to add info to for 450 rows, i can identify each row with a unique order number and only need to update 4 of the rows on the table for each order number.
update ordercontacts
set firstname = 'joe', lastname = 'smith', email = 'joesmith@smith.com', contacttypeid = 13
where orderid = 1284480
this just replaced my values so i had to fix that
i tried this as well
insert into ordercontacts
(firstname, lastname, email, contacttypeid)
values
('joe', 'smith', 'jowsmith@smith.com', 13)
where orderid in (1284480)
but the syntax is not correct and im not sure what the correct syntax would be
I had thought something like this would work but it doesnt obviously. Can anyone help me out? Each of the order numbers already has a different contact attached to it, i basically want the end result to be like this:
order firstname lastname email contacttypeid
1284480 joe smith joesmith@smith.com 13
1284480 steve andrews steve@steve.com 11
Im looking to add a new contact on top of one that already exists for each order number. The syntax for the update i have is only replacing the info that is already there.
You’re wanting to insert values rather than update. Update will overwrite the values of the existing one, essentially it’s “replace x in the row where id = y”. Insert will actually create a new row.