日期:2014-05-17  浏览次数:20365 次

如何写这样的查询结果。
表A:
Aid   Bid    Ctext
1     1       2
2     2       2
3       
4     3       1
5     4       1

表B
Bid   text
1     A
2     B
3     C
4     D



如何查询这样的结果:
从表B的text字段中查询得到结果表 A的Ctext的值是“1”的第一个值,两个表通过 Bid关联。

------解决方案--------------------
select top 1 * from a,b where a.bid=b.bid and ctext=1 order by aid?