-
Notifications
You must be signed in to change notification settings - Fork 857
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
子查询报错 是因为Type关键字吗? #1118
Comments
使用 .Where("o.ActivityType = a.Type", null)正常 |
[Fact]
public void PropertyType()
{
var fsql = g.mysql;
var item = new issues1118_01 { Type = "xxx" };
var list1 = fsql.Select<issues1118_01>()
.Where(o => o.Type == item.Type)
.ToList();
}
public class issues1118_01
{
public int id { get; set; }
public string name { get; set; }
public string Type { get; set; }
} 测试正常 |
那会是什么原因呀 |
是在子查询里面哦,外面查询没问题的 |
[Fact]
public void PropertyType()
{
var fsql = g.mysql;
var item = new issues1118_01 { Type = "xxx" };
var list1 = fsql.Select<issues1118_01>()
.ToList(ac => new {
count = fsql.Select<issues1118_01>().Where(o => o.Type == ac.Type).First(o => o.name)
});
}
public class issues1118_01
{
public int id { get; set; }
public string name { get; set; }
public string Type { get; set; }
} 也没问题哦,试试把 ac 改名为 a |
打印 SQL,正常吗 |
他是提示找不到 a.`Type`,SalesmanActivityConfig 这个表 |
|
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
使用.Where(o => o.ActivityType == ac.Type)报错
版本号:3.2.640
var activityPeopleCountList = _fsql.Select<SalesmanActivityConfig>() .Where(a => a.SalesmanId == req.SalesmanId) .ToList(a => new ActivityPeopleCountModel { Type = a.Type, Count = _fsql.Select<SalesmanActivityOrder>() .Where(o => o.SalesmanId == a.SalesmanId) .Where(o => a.Type == o.ActivityType)//报错ArgumentException: Requested value 'a.
Type' was not found. //.Where("o.ActivityType = a.Type", null)//正常 .Where(o => o.PayStatus == SalesmanActivityOrderPayStatusEnum.YiWanCheng) .WhereIf(req.StartTime.HasValue, o => o.AddTime.Between(req.StartTime.Value, req.EndTime.Value)) .Count(), });
The text was updated successfully, but these errors were encountered: