mysql,连续两行符合条件的记录该如何查?求高手相助

mysql,连续两行符合条件的记录该怎么查?求高手相助

我现在想查询符合以下条件的记录。

1.该记录的type=’a’

2.该记录下一条的记录的type=’b’

假设表的结构为:

id type value

1 a 1

2 a 1

3 b 1

4 b 1

查询后,返回第二条的记录。

———————

有高手告诉小弟怎么查询么,谢了~~~



select * from 假设表 a where type=’a’ and ‘b’=(select type from 假设表 where id>a.id order by id limit 1)

mysql,连续两行符合条件的记录该如何查?求高手相助

相关文章:

你感兴趣的文章:

标签云: