我想从一些表中选择一些字段请帮助将 sql 查询转换为 linq,我需要将这些值显示到 mvc3 webgrid 中。
如何将内部联接转换为 linq?或者有什么办法可以在EF中做到这一点?
SELECT
DISTINCT
SecurityIdentifier_All.SecurityId,
NAV.CompanyName,
NAV.SecurityType,
SecurityIdentifier_All.Identifier,
SecurityIdentifier_All.SecurityIdentifierTypeId
FROM
Fireball_Reporting..Reporting_DailyNAV_Pricing NAV
INNER JOIN
Fireball_Reporting..SecurityIdentifier_All ON
SecurityIdentifier_All.SecurityId = NAV.PricingSecurityID
inner join
(
SELECT SecurityId, MAX(SecurityIdentifierTypeId) SecurityIdentifierTypeId
FROM Fireball_Reporting..SecurityIdentifier_All
where SecurityIdentifierTypeId in (1,16)
group by SecurityId
) IdentifierType on
IdentifierType.SecurityId = SecurityIdentifier_All.SecurityId and
IdentifierType .SecurityIdentifierTypeId =
SecurityIdentifier_All.SecurityIdentifierTypeId
WHERE
Date = Fireball_Configuration.dbo.PreviousBusinessDay()
在上面SecurityIdentifier_All
,NAV
是一个视图。Fireball_Reporting 数据库名称。在答案中直到第一个内部连接完成。请帮我完成最后一部分。