mysql 能同时更新一条数据并返回这条数据的内容吗
1个回答
展开全部
mysql没这种功燃扰能。
pgsql有
UPDATE [ ONLY ] table [ [ AS ] alias ]
SET { column = { expression | DEFAULT } |
( column [, ...] ) = ( { expression | DEFAULT } [, ...] ) } [, ...]
[ FROM fromlist ]
[ WHERE condition ]
[ RETURNING * | output_expression [ AS output_name ] [, ...] ]
INSERT INTO table [ ( column [, ...] ) ]
{ DEFAULT VALUES | VALUES ( { expression | DEFAULT } [, ...] ) [, ...] | query }
[ RETURNING * | output_expression [ AS output_name ] [, ...] ]
使用 RETURNING 返回需要的字段即可。这也是标准的安全的获耐唯得 insert_id值的做昌段培法。
pgsql有
UPDATE [ ONLY ] table [ [ AS ] alias ]
SET { column = { expression | DEFAULT } |
( column [, ...] ) = ( { expression | DEFAULT } [, ...] ) } [, ...]
[ FROM fromlist ]
[ WHERE condition ]
[ RETURNING * | output_expression [ AS output_name ] [, ...] ]
INSERT INTO table [ ( column [, ...] ) ]
{ DEFAULT VALUES | VALUES ( { expression | DEFAULT } [, ...] ) [, ...] | query }
[ RETURNING * | output_expression [ AS output_name ] [, ...] ]
使用 RETURNING 返回需要的字段即可。这也是标准的安全的获耐唯得 insert_id值的做昌段培法。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询