通过连接PostgreSQL中的列进行更新
我需要通过将hotelcode与vendorcitycode(用下划线分隔)连接起来来设置hotelcode,如下所示通过连接PostgreSQL中的列进行更新,postgresql,syntax-error,Postgresql,Syntax Error,我需要通过将hotelcode与vendorcitycode(用下划线分隔)连接起来来设置hotelcode,如下所示 update schema.table_name set hotelcode = hotelcode+"_"+vendorcitycode) where vendorid = 'INV27' and vendorcitycode = 'LON' 注: hotelcode和vendorcitycode是类型为字符变化(100)的两列。 我使用的是PostgreS
update schema.table_name set
hotelcode = hotelcode+"_"+vendorcitycode)
where vendorid = 'INV27' and vendorcitycode = 'LON'
注:
hotelcode
和vendorcitycode
是类型为字符变化(100)
的两列。
我使用的是PostgreSQL 8.0。我不知道这是否是您获得否决票的原因,但答案很容易在文档中找到。PostgreSQL版本8.0不受支持;你应该尽快安排升级。
UPDATE table_name
SET hotelcode = hotelcode || '_' || vendorcitycode
WHERE (vendorid, vendorcitycode) = ('INV27', 'LON')