求个EF中的Linq按月查询的代码,该怎么解决
答案:2 悬赏:50 手机版
解决时间 2021-03-18 11:53
- 提问者网友:情歌越听越心酸
- 2021-03-17 21:11
求个EF中的Linq按月查询的代码,该怎么解决
最佳答案
- 五星知识达人网友:duile
- 2021-03-17 22:30
假设 该数据库的 LINQ To sql 类名称为 MyDataContext
using ( MyDataContext context = new MyDataContext() )
{
var results = from o in context.customer_info
where o.FileName == ""
group o by o.pickup.ToString( "yyyy'年'MM'月'" ) into groups
select new { Date = groups.Key, InCome = groups.Sum( v => v.remnant) + groups.Sum( v => v.money) };
using ( MyDataContext context = new MyDataContext() )
{
var results = from o in context.customer_info
where o.FileName == ""
group o by o.pickup.ToString( "yyyy'年'MM'月'" ) into groups
select new { Date = groups.Key, InCome = groups.Sum( v => v.remnant) + groups.Sum( v => v.money) };
全部回答
- 1楼网友:归鹤鸣
- 2021-03-17 23:49
你说呢...
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯