0

以下は、いくつかの条件に基づいてLinqを使用していくつかのテーブルを結合している私のクエリです

var Info = from tblcol1 in Table1
           join tblcol2 in dc.Table2 on tblcol1.EmailID equals tblcol2.EmailID
           join tblcol3 in dc.Table3 on tblcol1.EmailID equals tblcol3.EmailID
           join tblcol4 in dc.Table4 on tblcol3.GroupID equals tblcol4.GroupID
           join tblcol5 in dc.Table5 on tblcol4.RID equals tblcol5.RID
           join tblcol6 in dc.Table6 on tblcol2.RID equals tblcol6.RID
           join tblcol7 in dc.Table7 on tblcol1.EmailID equals tblcol7.EmailID
           where tblcol1.UserId.Equals(gUserID)
           select new Class1()
           {
               EmailID = tblcol1.EmailID.ToString(),
               EmailName = tblcol1.Name.ToString(),
               OpenCount = tblcol7.OpenCount,
               ReadCount = tblcol7.ReadCount,
               TotalCount = tblcol5.RID + tblcol6.RID,
               UnsubscribeCount = tblcol6.IsUnsubscribed + tblcol5.IsUnsubscribed,
           };
List = Info.ToList();

ここで、RID は GUID(C#)/Unique Identifier(SQL) であり、IsUnsubscribed は SQL データテーブルのビットです。

上記のクエリで TotalCount と UnsubscribedCount を計算する必要があります。

TotalCount = tblcol5.RID + tblcol6.RID,
UnsubscribeCount = tblcol6.IsUnsubscribed + tblcol5.IsUnsubscribed,

どうすればそれを達成できますか?

4

0 に答える 0