jamespakorn / jamespakorn/hdc-sql

waist_3034

Open
#15 0 comments 0 reactions 0 assignees View on GitHub
คำสั่ง sql
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

```sql
#SET @prov_c := '14';
SET @b_year:='2017';
SET @start_d:=concat(@b_year-1,'1001');
SET @end_d:=concat(@b_year,'0930');
#SET @date_3:=concat(@b_year-14,'1001');

select
#if(p.SEX=1,if(n.WAIST_CM<=90,concat(p.HOSPCODE,'-',p.PID),null),if(p.SEX=2,if(n.WAIST_CM<=80,concat(p.HOSPCODE,'-',p.PID),null),null))
COUNT(DISTINCT if(p.SEX=1,if(n.WAIST_CM<=90,concat(p.HOSPCODE,'-',p.PID),null),if(p.SEX=2,if(n.WAIST_CM<=80,concat(p.HOSPCODE,'-',p.PID),null),null))) as A,
COUNT(DISTINCT CONCAT(n.HOSPCODE,'-',n.PID)) as B
from ncdscreen n
inner join person p on p.HOSPCODE=n.HOSPCODE and p.PID=n.PID
where DATE_SERV BETWEEN @start_d AND @end_d
and TIMESTAMPDIFF(YEAR,p.BIRTH,n.DATE_SERV) BETWEEN 30 and 44
and n.WAIST_CM BETWEEN 10 and 500

Contributor guide

No contributing guide indexed for this repository

Research direction

Review the SQL snippet in issue #15, including the ncdscreen and person tables, the date variables, and the waist and age filters. The issue does not state what should be changed or provide an acceptance criterion, so the intended result must be clarified before implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql
Domain
database
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.