此查询有效:
select id from wagtailcore_pagerevision
where id in (select live_revision_id as id from wagtailcore_page)
此查询没有结果:
select id from wagtailcore_pagerevision
where id not in (select live_revision_id as id from wagtailcore_page)
(区别是in
vs。 not in
。)
...但是通过检查数据我可以很清楚地看到第二个查询的结果应该有数百行。
live_revision_id
列上确实存在索引,并且id
当然是主键。