Update Mysql

This commit is contained in:
sunkaixuan 2019-02-10 14:41:05 +08:00
parent c07ab9298d
commit f87ece6d84
2 changed files with 10 additions and 1 deletions

View File

@ -174,6 +174,8 @@ namespace OrmTest.Demo
var list3 = db.Queryable<Student>()
.PartitionBy(it => new { it.Id, it.Name }).Take(1).ToList();
var list31 = db.Queryable<Student>()
.PartitionBy(it => new { it.Id, it.Name }).Take(1).Count();
//SQL:
//SELECT AVG([Id]) AS[idAvg], [Name] AS[name] FROM[Student] GROUP BY[Name],[Id] HAVING(AVG([Id]) > 0 )

View File

@ -65,7 +65,14 @@ namespace SqlSugar
}
public override string ToCountSql(string sql)
{
return Regex.Replace(sql,"^SELECT .+? FROM ", "SELECT COUNT(*) FROM ");
if (this.GroupByValue.HasValue())
{
return base.ToCountSql(sql);
}
else
{
return Regex.Replace(sql, "^SELECT .+? FROM ", "SELECT COUNT(*) FROM ");
}
}
#endregion