如何用(连接,分组和条件)编写linq查询 [英] How to write linq queries with ( Joins, Group by and Where Conditions)

查看:50
本文介绍了如何用(连接,分组和条件)编写linq查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Sql查询是







SELECT Count(dbo.StudentAttendancechild.Status), dbo.StudentAttendancechild.AttendanceID,dbo.StudentAttendancechild.AdmissionNo,

dbo.StudentAttendanceMaster.Class,dbo.StudentAttendanceMaster.Date

来自dbo.StudentAttendancechild INNER JOIN

dbo.StudentAttendanceMaster ON dbo.StudentAttendancechild.AttendanceID = dbo.StudentAttendanceMaster.ID



其中dbo.StudentAttendancechild.Admission ='111'和dbo.StudentAttendancechild.Status ='现在'

group by dbo.StudentAttendancechild.AdmissionNo,dbo.StudentAttendanceMaster.Class,dbo.StudentAttendanceMaster.Date,dbo.StudentAttendancechild.AttendanceID









可以任何人帮我在LINQ写查询



先谢谢........................

解决方案

有很多文章和视频 [ ^代码项目,这里有很好的解释和LINQ的例子。



这是一个:

LINQ简介第1部分,共3部分 [ ^ ]


My Sql Query is



"SELECT Count(dbo.StudentAttendancechild.Status),dbo.StudentAttendancechild.AttendanceID, dbo.StudentAttendancechild.AdmissionNo,
dbo.StudentAttendanceMaster.Class, dbo.StudentAttendanceMaster.Date
FROM dbo.StudentAttendancechild INNER JOIN
dbo.StudentAttendanceMaster ON dbo.StudentAttendancechild.AttendanceID = dbo.StudentAttendanceMaster.ID

where dbo.StudentAttendancechild.Admission='111' and dbo.StudentAttendancechild.Status='Present'
group by dbo.StudentAttendancechild.AdmissionNo, dbo.StudentAttendanceMaster.Class,dbo.StudentAttendanceMaster.Date,dbo.StudentAttendancechild.AttendanceID"




can Any one help me to write query in LINQ

Thanks in Advance........................

解决方案

There are many articles and videos[^] here on Code Project that have great explainations and examples for LINQ.

Here is one:
LINQ Introduction Part 1 Of 3[^]


这篇关于如何用(连接,分组和条件)编写linq查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆