求救于SqlServer高手.
我有一张表,表中有个字段:id(int)和另外一个字段:i_text(text)
表中内容如下:
id i_text
1 a
1 b
1 c
2 e
2 f
2 g
我需要的sql语句如下:
读取id=1和id=2的所有的前两条记录.
------解决方案--------------------select top 2 * from yourtable where id = 1
union
select top 2 * from yourtable where id = 2
------解决方案--------------------select top 2 * from table1 as t1 where id=1 union select top 2 * from table1 as t2 where id=2