mirror of
https://github.com/dotnetcore/FreeSql.git
synced 2026-02-04 15:30:53 +08:00
update
@@ -46,6 +46,16 @@ var list = fsql.Select<Topic>()
|
|||||||
|
|
||||||
> To find the aggregate value without grouping, please use `ToAggregate` instead of `ToList`
|
> To find the aggregate value without grouping, please use `ToAggregate` instead of `ToList`
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
var list = fsql.Select<Topic>()
|
||||||
|
.ToAggregate(a => new
|
||||||
|
{
|
||||||
|
cou1 = a.Count(),
|
||||||
|
arg1 = a.Avg(a.Value.Clicks),
|
||||||
|
arg2 = a.Sum(a.Value.Clicks > 100 ? 1 : 0)
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
## Navigation Property Grouping
|
## Navigation Property Grouping
|
||||||
|
|
||||||
If `Topic` has the navigation property `Category`, and `Category` has the navigation property `Area`, the navigation property grouping code is as follows:
|
If `Topic` has the navigation property `Category`, and `Category` has the navigation property `Area`, the navigation property grouping code is as follows:
|
||||||
|
|||||||
10
分组聚合查询.md
10
分组聚合查询.md
@@ -45,6 +45,16 @@ var list = fsql.Select<Topic>()
|
|||||||
|
|
||||||
> 不分组求聚合值,请使用 ToAggregate 替代 ToList
|
> 不分组求聚合值,请使用 ToAggregate 替代 ToList
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
var list = fsql.Select<Topic>()
|
||||||
|
.ToAggregate(a => new
|
||||||
|
{
|
||||||
|
cou1 = a.Count(),
|
||||||
|
arg1 = a.Avg(a.Value.Clicks),
|
||||||
|
arg2 = a.Sum(a.Value.Clicks > 100 ? 1 : 0)
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
## 导航属性分组
|
## 导航属性分组
|
||||||
|
|
||||||
假如 Topic 有导航属性 Category,Category 又有导航属性 Area,导航属性分组代码如下:
|
假如 Topic 有导航属性 Category,Category 又有导航属性 Area,导航属性分组代码如下:
|
||||||
|
|||||||
Reference in New Issue
Block a user