gpt4 book ai didi

mysql - 选择同时更新所有行 MYSQL

转载 作者:行者123 更新时间:2023-11-30 01:11:07 25 4
gpt4 key购买 nike

我正在尝试更新并选择与以下相同的表:

UPDATE tbl_domain SET remain = 
(SELECT DATEDIFF(expdate,NOW()) FROM (
SELECT DATEDIFF(expdate,NOW()) FROM tbl_domain
) as x )

我怎样才能让它发挥作用?有人请帮助我!!!

最佳答案

试试这个:

UPDATE tbl_domain t, (SELECT DATEDIFF(expdate,NOW()) as remain
FROM tbl_domain
) t1
SET t.remain = t1.remain
-- WHERE t.Id = t1.Id --If you have some kind of unique id in your table.

关于mysql - 选择同时更新所有行 MYSQL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19462032/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com