SqlSugar 子查询两种方式

方式一:

_repOrder.AsQueryable()
.Select(p => new OrderDetailOutputDto
 {
    DriverName = SqlFunc.Subqueryable().Where(user => user.Id == p.DriverId).Select(user => user.FirstName + user.LastName),
}.ToList();

方式二: 

string driverScoreSqlStr = "(select passenger_score from order_score where order_number = order_info.order_number)"

_repOrder.AsQueryable()
.Select(p => new OrderDetailOutputDto
{
     PassengerScore = SqlFunc.MappingColumn(default(string), driverScoreSqlStr ),
}

你可能感兴趣的:(数据库,SqlSugar)