当前位置:Gxlcms > 数据库问题 > SqlSugar 查询指定列 返回指定列 查特定的列节约资源加快速度

SqlSugar 查询指定列 返回指定列 查特定的列节约资源加快速度

时间:2021-07-01 10:21:17 帮助过:4人阅读

: 返回指定列匿名类集合2
3
var data = db.Queryable<Student>()
4
    .Select(f => new
5
    {
6
      f.ID,
7
      f.Name
8
    }).ToList();
9
/*
10
生成SQL:
11
SELECT  [ID] AS [ID] , [Name] AS [Name]  FROM [Student] 
12
其它数据库类似, 不一一列举
13
*/
三: 返回单个列集合

//返回值为List<string>
List<string> data = db.Queryable<Student>().Select(f => f.Name).ToList();
/*
生成SQL:
SELECT [Name] FROM [Student] 
其它数据库类似, 不一一列举
*/
 1
: 返回单个列集合
2
3
//返回值为List<string>
4
List<string> data = db.Queryable<Student>().Select(f => f.Name).ToList();
5
/*
6
生成SQL:
7
SELECT [Name] FROM [Student] 
8
其它数据库类似, 不一一列举
9
*/

SqlSugar 查询指定列 返回指定列 查特定的列节约资源加快速度

标签:dem   lines   string   present   back   com   cursor   mirror   ble   

人气教程排行