当前位置:网站首页>How does SQLite count the data that meets another condition under the data that has been classified once
How does SQLite count the data that meets another condition under the data that has been classified once
2022-07-06 14:25:00 【CSDN Q & A】
Data is a bunch of information about children , I'll count them by race first , Then I will count the number of sick children in each race .
Problem situation :

I think there is something wrong with the red line above me , But after trying for a long time, I don't know what's wrong .
I hope to achieve the effect like the following , Connect the two columns , Then calculate the ratio .

I hope some students can help solve it , thank you !
Take the answer :
This problem can be solved by case when Write for processing , The specific implementation can refer to the following code :
select Ethnicity,sum(case when [Class/ASDTraits] = "Yes" then 1 else 0 end ) -- Number of sick children ,count(*) -- The number of children of all ethnic groups ,sum(case when [Class/ASDTraits] = "Yes" then 1 else 0 end ) /count(*) --- Prevalence rate from ASDgroup by Ethnicity边栏推荐
- 强化学习基础记录
- Ucos-iii learning records (11) - task management
- 7-14 error ticket (PTA program design)
- How to turn wechat applet into uniapp
- Experiment 6 inheritance and polymorphism
- Load balancing ribbon of microservices
- Proceedingjoinpoint API use
- 7-11 mechanic mustadio (PTA program design)
- Which is more advantageous in short-term or long-term spot gold investment?
- sqqyw(淡然点图标系统)漏洞复现和74cms漏洞复现
猜你喜欢
随机推荐
A complete collection of papers on text recognition
搭建域环境(win)
HackMyvm靶机系列(3)-visions
外网打点(信息收集)
Which is more advantageous in short-term or long-term spot gold investment?
The United States has repeatedly revealed that the yield of interest rate hiked treasury bonds continued to rise
XSS unexpected event
《统计学》第八版贾俊平第十二章多元线性回归知识点总结及课后习题答案
小程序web抓包-fiddler
7-8 7104 Joseph problem (PTA program design)
Intranet information collection of Intranet penetration (I)
Yugu p1012 spelling +p1019 word Solitaire (string)
2022华中杯数学建模思路
Hackmyvm Target Series (3) - vues
Experiment 7 use of common classes (correction post)
Intranet information collection of Intranet penetration (2)
Apache APIs IX has the risk of rewriting the x-real-ip header (cve-2022-24112)
Experiment 9 input and output stream (excerpt)
XSS之冷门事件
Record once, modify password logic vulnerability actual combat









