Click here to Skip to main content
15,790,795 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Can any one convert this sql query into LINQ or LAMBDA Expression.

SQL
select [Id]
      ,[Name]
      ,[Ordinal]
      ,[ThemeId]
      ,[CourseDisplayTitle]
      ,[CourseLocation]
      ,[Enabled]
      ,[FriendlyId]
      ,[DateCreated]
      ,[IsDeleted]
      ,[DateDeleted]
      ,[IsDummyData]
      ,case when Count is null then 0 else count end  as 'count'
       from (
  SELECT [Id]
      ,[Name]
      ,[Ordinal]
      ,[ThemeId]
      ,[CourseDisplayTitle]
      ,[CourseLocation]
      ,[Enabled]
      ,[FriendlyId]
      ,[DateCreated]
      ,[IsDeleted]
      ,[DateDeleted]
      ,[IsDummyData]
  FROM [dbo].[Courses]) A
  LEFT OUTER JOIN
  
  (select courseId,count(*) AS 'Count'
  from [TTF-Unitron].[dbo].[Modules]
  group by courseid) B
  ON a.id= b.courseid
Posted

1 solution

using (TicketingAppEntities tap = newTicketingAppEntities())
{
varqptr = from t intap.TicketActivities.Include("Staff")
letearSize = t.ElapsedMinutes
wheret.dtStart<datetime.now.adddays(-32)>
groupt.ixTasksbyt.ixStaffintoStaffTasks
selectnew {
Staffer = StaffTasks.Key,
Tasks = StaffTasks.ToList()
};

};
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900