Problem Description:
Table Structure
ID Title Body ClassID
1 AAAAA AFDS 1
2 BBB DSAA 1
3 CCC FDSA 2
4 DDD DASA 2
5 Eee FDSA 2
Two after the ClassID is 1, the lassid is 2 after 2
become
1 AAAAA AFDS 1
2 BBB DSAA 1
4 DDD DASA 2
5 Eee FDSA 2
solution:
SELECT * FROM
table
a where id in (SELECT TOP 2 id from
table
Where classid = a.classID)