读书人

求查询话语效率最高的

发布时间: 2013-06-19 10:26:41 作者: rapoo

求查询语句,效率最高的!
表1
AID (int PK)
LID (int )
lType (char(10))
Ints (varbinary(2000))

LID和lType 有唯一约束

表2

AID (int FK)
HID (int)
NumKey (int)
Count (int)

AID 和 HID 和 NumKey 唯一约束

表1中的数据如下
1 1000 apple ...................
2 1001 apple ...................
3 1002 orange ...................
....


表2中的数据如下
1 65444 3 8
1 65444 4 9
1 65444 5 2
2 65444 2 6
2 65444 9 2

..................


要求:

查询到 lType = apple 的记录
结果为
1 1000 apple ......... 65444 3 8 4 9 5 2
2 1001 apple ......... 65444 2 6 9 2

读书人网 >SQL Server

热点推荐