-
Notifications
You must be signed in to change notification settings - Fork 172
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
group by 查询多个表提示Value cannot be null #257
Comments
query.groupby(g=> g.time).select(q=> new{time=q.Key}).count() 试试这种写法呢,你的问题我这几天看看 |
当然这边也建议你用distinct来代替呢,比如query.select(q=> q.time).distinct().count() |
group的限制是查询的结果必须包含group时候的key,所以先group后select是满足这个情况的,包括tolist这种需要先select后orderby而不是先orderby后select |
query.groupby(g=> g.time).select(q=> new{time=q.Key}).count() 这种写法也试过,会报错:[Key] not in type:[Table] |
@wodemingzijiaoke 实在不好意思因为分片+group是一种比较复杂的聚合处理,如果您不涉及分库那么可以使用shardingcore的unionmerge 具体代码参考 https://github.com/dotnetcore/sharding-core/tree/main/samples/Sample.SqlServer |
好的,我去试下 |
我用的是mysql8,我在mysql的demo中没有找到关于unionmerge的用法,可以提供下demo吗 |
和sqlserver处理一样就换一下对应的方言生成器就好了 |
使用query.select(q=> q.time).groupby(g=> g).count() Linq报错, Value cannot be null。查询的表有的是没有数据的。但是查单个表是不会报这个错的
The text was updated successfully, but these errors were encountered: