【发布时间】:2012-04-04 23:02:46
【问题描述】:
我有以下表格:
create table TableA (
Id int primary key identity,
Key int not null
)
create table TableB (
Id int primary key identity,
TableA_Id int not null foreign key references TableA(Id),
Value varchar(80) not null
)
我想使用 lambda 表示法在 LINQ-to-SQL 中编写以下查询:
select TableA.Key, b.Value
from TableA
cross apply (
select top 10 TableB.Value
from TableB
where TableA.Id = TableB.TableA_Id
order by TableB.Value
) b
where TableA.Key between 0 and 999
我该怎么做?
【问题讨论】:
标签: linq linq-to-sql