I need to set the hotelcode by concatenating it with the vendorcitycode (separated by an underscore) as follows.
update schema.table_name set
hotelcode = hotelcode+"_"+vendorcitycode)
where vendorid = 'INV27' and vendorcitycode = 'LON'
Note :
hotelcode
and vendorcitycode
are two columns of type character varying(100)
.
I use PostgreSQL 8.0.
First, specify the name of the table that you want to update data after the UPDATE keyword. Second, specify columns and their new values after SET keyword. The columns that do not appear in the SET clause retain their original values. Third, determine which rows to update in the condition of the WHERE clause.
UPDATE table_name
SET hotelcode = hotelcode || '_' || vendorcitycode
WHERE (vendorid, vendorcitycode) = ('INV27', 'LON')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With