mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-10-26 02:39:14 +08:00
Update GroupBy exp to sql
This commit is contained in:
@@ -100,6 +100,7 @@
|
||||
<Compile Include="UnitTest\Models\UserEntity.cs" />
|
||||
<Compile Include="UnitTest\Models\UserRoleEntity.cs" />
|
||||
<Compile Include="UnitTest\UCustom01.cs" />
|
||||
<Compile Include="UnitTest\UCustom09.cs" />
|
||||
<Compile Include="UnitTest\UCustom011.cs" />
|
||||
<Compile Include="UnitTest\UCustom02.cs" />
|
||||
<Compile Include="UnitTest\UCustom03.cs" />
|
||||
|
||||
@@ -31,6 +31,7 @@ namespace OrmTest
|
||||
}
|
||||
public static void Init()
|
||||
{
|
||||
UCustom09.Init();
|
||||
UCustom011.Init();
|
||||
UCustom010.Init();
|
||||
UCustom08.Init();
|
||||
|
||||
31
Src/Asp.Net/SqlServerTest/UnitTest/UCustom09.cs
Normal file
31
Src/Asp.Net/SqlServerTest/UnitTest/UCustom09.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using OrmTest.UnitTest.Models;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrmTest
|
||||
{
|
||||
public class UCustom09
|
||||
{
|
||||
public static void Init()
|
||||
{
|
||||
var db = NewUnitTest.Db;
|
||||
var list=db.Queryable<Order>()
|
||||
.GroupBy(x => new { CreateTime = x.CreateTime.ToString("yyyy-MM"),x.Name })
|
||||
.Select(x => new { CreateTime = x.CreateTime.ToString("yyyy-MM") }).ToList();
|
||||
}
|
||||
public class Unitasfa1sadfa
|
||||
{
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
public Guid Id { get; set; }
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public bool ItemId { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user