下面我有以下SQL,我怎麼在LINQ實現這個(C#請:))如何做LINQ
SELECT a.Category, a.Description, a.Item, a.[Value], a.Loading, a.MaxDiscount, MIN(b.EffectiveDate) AS FromDate, a.EffectiveDate AS EndDate, a.SortOrder, a.ID
FROM List a
LEFT OUTER JOIN List b ON a.[Value] = b.[Value] AND a.Category = b.Category AND a.Description = b.Description AND a.Item = b.Item AND a.EffectiveDate < b.EffectiveDate
GROUP BY a.Category, a.Description, a.Item, a.[Value], a.Loading, a.MaxDiscount, a.SortOrder, a.EffectiveDate, a.ID
HAVING (a.Category = 'General') AND (a.Description = 'Cover') AND (a.EffectiveDate <= CONVERT(DATETIME, '2009-04-01 00:00:00', 102)) AND (MIN(b.EffectiveDate) >= CONVERT(DATETIME, '2009-04-01 00:00:00', 102) OR MIN(b.EffectiveDate) IS NULL) AND (a.Item = 'Type')
ORDER BY a.SortOrder
我有以下的(使用亞音速LINQ)
var query = from a in List.All() join b in List.All()
on new {a.Value,a.Category ,a.Description,a.Item}
equals new {b.Value,b.Category ,b.Description,b.Item} into temp
我不知道如何在此刻
至少讓我們看看你到目前爲止,否則我們只是最終爲你做所有的工作,沒有什麼是學習的。 – leppie 2009-07-21 09:53:35
我有以下(使用SubSonic Linq) var query = from a in List.All() join b in List.All()on new {a.Value,a.Category,a.Description,a。項目} 等於新{b.Value,b.Category,b.Description,b.Item} 到臨時 我不知道如何添加a.EffectiveDate
Podge
2009-07-21 10:00:00