今日のひとこま

select
 *
from
 ( select * from hoge order by id limit 10 ) as hoge
 join hage on hoge.id = hage.id
where
 hoge.id in ( select id from foo )

と10件にした後、絞られてたので、

select
 *
from
 ( select * from hoge where id in ( select id from foo ) order by id limit 10 )
 join hage on hoge.id = hage.id

絞った後、10件にするように修正する。

実際はもっと長いSQLだったので辛かったですお。