Skip to content

分组查询如何实现按不同条件多次Count? #1397

Answered by 2881099
LeaFrock asked this question in Q&A
Discussion options

You must be logged in to vote

不要用 COUNT,用 SUM,这其实是 SQL 知识体系啊。

g.Sum(g.Value.Province == "广东省" ? 1 : 0) 对应

SUM(case when province = '广东省' then 1 else 0)

Replies: 3 comments 5 replies

Comment options

You must be logged in to vote
2 replies
@LeaFrock
Comment options

@2881099
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@LeaFrock
Comment options

@2881099
Comment options

@2881099
Comment options

Answer selected by LeaFrock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants