rXRgln.gif

select id from (select id from testtable order by id asc) t where not exists (select 1 from testtable where id=t.id-1)

mysql的in和exists

in适合于外表大而内表小的情况,exists适合于外表小而内表大的情况。

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

Captcha Code