当前查询是:
update topics set posts = (select count(*) from posts where tid = 27), lastpost = (select max(pid) from posts where tid = 27) where tid = 27;
如何将两个子查询合并到更新查询中?
select count(*), select max(pid) from posts where tid = 27)
显然,我可以将其作为两个单独的查询来执行(从帖子中读取值,将值写入主题),但如果可能的话,我想在单个查询中执行此操作。