Postgresql两表联合更新近日使用Postgresql感到有点不好用,一个联合更新非要这样写语法才对:update d_routetripset name=b.name , description=b.description from d_scenery as bwhere foreignid=b.id and d_routetrip.type='scenery' 如上所述,and 前的 d_routetrip表不能起别名,set后应用到此表也直接用字段表示,无需引用别名否则语法…
create table test1 as select * from dba_objects; create table test2 as select * from dba_objects; create unique index test1_idx1 on test1(object_id); select * from test1; create table test3 as select object_id,object_name from test1 update test1 set…
最近用PostgreSql数据库进行表关联更新时,发现与之前用的Sql Server 和My Sql语法有很大差别,稍微不注意,很容易出错. PostgreSql表更新时,两个表只允许一个表起别名,一般是被更新的表不起别名,查询的表起别名 正确的写法如下 SELECT * from pro.book; SELECT * from pro.book_detail; UPDATE pro.book_detail set book_name=tab1.book_name from pro.book t…