当前位置:网站首页>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
边栏推荐
- Tencent map circle
- Experiment 7 use of common classes (correction post)
- Proceedingjoinpoint API use
- Record an API interface SQL injection practice
- Low income from doing we media? 90% of people make mistakes in these three points
- Captcha killer verification code identification plug-in
- 7-1 output all primes between 2 and n (PTA programming)
- Harmonyos JS demo application development
- Hackmyvm target series (1) -webmaster
- UGUI—Text
猜你喜欢
Wei Shen of Peking University revealed the current situation: his class is not very good, and there are only 5 or 6 middle-term students left after leaving class
7-7 7003 combination lock (PTA program design)
New version of postman flows [introductory teaching chapter 01 send request]
Based on authorized access, cross host, and permission allocation under sqlserver
Detailed explanation of network foundation
HackMyvm靶机系列(7)-Tron
Chain team implementation (C language)
xray与burp联动 挖掘
强化学习基础记录
Harmonyos JS demo application development
随机推荐
浅谈漏洞发现思路
链队实现(C语言)
Apache APIs IX has the risk of rewriting the x-real-ip header (cve-2022-24112)
"Gold, silver and four" job hopping needs to be cautious. Can an article solve the interview?
7-15 h0161. Find the greatest common divisor and the least common multiple (PTA program design)
【Numpy和Pytorch的数据处理】
Hackmyvm target series (6) -videoclub
外网打点(信息收集)
The most popular colloquial system explains the base of numbers
captcha-killer验证码识别插件
Attack and defense world misc practice area (GIF lift table ext3)
Interpretation of iterator related "itertools" module usage
Harmonyos application development -- address book management system telmanagesys based on listcontainer [phonebook][api v6]
sqqyw(淡然点图标系统)漏洞复现和74cms漏洞复现
Hackmyvm Target Series (3) - vues
Harmonyos JS demo application development
Captcha killer verification code identification plug-in
Middleware vulnerability recurrence Apache
Library management system
Intel oneapi - opening a new era of heterogeneity