我正在尝试更新并选择与以下相同的表格:
UPDATE tbl_domain SET remain =
(SELECT DATEDIFF(expdate,NOW()) FROM (
SELECT DATEDIFF(expdate,NOW()) FROM tbl_domain
) as x )
我怎样才能让它发挥作用?有人请帮帮我!!!
答案 0 :(得分:0)
试试这个:
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.