我有一个相对复杂的mysql语句,每次翻阅一百万条记录的表50(其中$ page = 50,100,150等): -
SELECT t.*
FROM (SELECT sb_pageid
FROM ailab_pages
ORDER BY sb_pageid LIMIT $page, 50) q
JOIN ailab_pages t ON t.sb_pageid = q.sb_pageid;
我需要使用当前日期更新UPDATED字段并尝试过此查询: -
UPDATE fbdatatmp.ailab_pages_copy dest,
((SELECT t.*
FROM (SELECT sb_pageid
FROM fbdatatmp.ailab_pages_copy
ORDER BY sb_pageid LIMIT 0, 50) q
JOIN fbdatatmp.ailab_pages_copy t ON t.sb_pageid = q.sb_pageid)) src
SET dest.updated = curdate() where dest.sb_pageid = src.sb_pageid;
我在MySQL Workbench中运行查询时收到此错误: -
10:14:09 UPDATE fbdatatmp.ailab_pages_copy dest,((SELECT t。* FROM (SELECT sb_pageid FROM fbdatatmp.ailab_pages_copy ORDER BY sb_pageid LIMIT 0,50)q JOIN fbdatatmp.ailab_pages_copy t ON t.sb_pageid = q.sb_pageid))src SET dest.updated = curdate()其中dest.sb_pageid = src.sb_pageid错误代码:1046。未选择数据库通过在SCHEMAS列表中双击其名称来选择要使用的默认数据库 在侧边栏。 0.190秒
如果我将内部选择更改为如下所示的简单选择,它可以正常工作但我需要查询按上述方式工作: -
UPDATE fbdatatmp.ailab_pages_copy dest,
(SELECT *
FROM fbdatatmp.ailab_pages_copy
ORDER BY sb_pageid LIMIT 0,50) src
SET dest.updated = curdate() where dest.sb_pageid = src.sb_pageid
有什么想法吗?
由于
乔纳森