0
:SQL:私はサンプルcounters.below 2上の2条件をテストする条件テスト
id_client | zipcode | timestamp | UC | MISS
--------------------------------------------------|--------|------
amar | 11111 | 2016-09-28 20:05:03.001 | 15 | 0
akbar | 11111 | 2016-09-28 20:05:03.001 | 50 | 1
antony | 11111 | 2016-09-28 20:07:03.001 | 110 | 0
amar | 11111 | 2016-09-28 20:08:03.001 | 5 | 1
select
date (CollectionTime) as dates,
id_client
case when UC <=15 THEN 'TB'
UC < 15 THEN 'TB'
UC > 15 AND UC <=40 THEN 'B'
UC >40 AND UC <=80 THEN 'M'
UC > 80 THEN 'TM'
ELSE 'NULL' END AS tranche_UC
case when MISS = O THEN 'BONNE'
MISS =1 THEN 'Mauvaise'
ELSE 'NULL' END AS note
from cm_stat
group by id_client
order by dates;
i」は
id_clien | zipcode | timestamp | trancheUC | MISS
--------------------------------------------------|-------- |------
amar | 11111 | 2016-09-28 20:05:03.001 | TB | 0
akbar | 11111 | 2016-09-28 20:05:03.001 | M | 1
antony | 11111 | 2016-09-28 20:07:03.001 | TM | 0
amar | 11111 | 2016-09-28 20:08:03.001 | TB | 1
ありがとう、それは働いている@エドギブス – lalarita