From ccc787892a0b3c433da0cfe5e92136f5d45976be Mon Sep 17 00:00:00 2001 From: AlexLEWIS Date: Mon, 27 Sep 2021 13:55:12 +0800 Subject: [PATCH] Updated With Sql (markdown) --- With-Sql.md | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/With-Sql.md b/With-Sql.md index 5cbe33a..b94dc91 100644 --- a/With-Sql.md +++ b/With-Sql.md @@ -152,8 +152,6 @@ FROM ( SELECT a.`Id`, a.`Clicks`, a.`TypeGuid`, a.`Title`, a.`CreateTime` WHERE ((a.`Title`) LIKE '%yyy%') ) a) ftb ``` -### 2、跨分表查询:AsTable 相同实体多次操作,等于 Union ALL 查询 - ### Cross Sub-Table Query: Wse AsTable for the Same Entity Multiple Times to Convert to UNION ALL Query ```c# @@ -190,7 +188,8 @@ fsql.Ado.CommandFluent($"{sql1} UNION ALL {sql2}") After using `UNION ALL`, there will be a problem if you paginate directly. Please see the specific example: -### 多次WithSql+Page存在问题:每个WithSql内都有一个Page分页 +### There is a problem with using WithSql + Page multiple times: There is a paging statement in each WithSql + ```csharp var sql1 = fsql.Select() .Where(a => a.Title.Contains("xxx")) @@ -219,15 +218,11 @@ limit 0,20) ftb ``` -多个sql union all使用withsql,直接Page分页,会导致每个子表都生效,子表都生成分页。 +After multiple Sql statements are combined with WithSql (and a `UNION ALL` statement is generated), if you directly use the `Page` method for paging, it will cause a paging statement to be generated in each sub-table. -WithSql 可以和 AsTable 实现分表的功能。 +`WithSql` can realize the function of sub-table with `AsTable`. When querying across sub-tables, paging will take effect in each sub-table (that is, each SQL paging in WithSql). -分表跨表查询的时候,分页是要向每个子表(即每个WithSql中的SQL分页)都生效。 - -## Solution - -### Call WithSql Multiple Times +### Solution: Call WithSql Multiple Times Call WithSql multiple times. If you need to paging, you need to follow the two steps below.