Connect to the database sqlite3 PULSOMETER
Turn the headers on and the switch to mode columns
sqlite> .headers on
sqlite> .mode columns
Having a look at the tables
sqlite> .tables
ACTIVIDADES REGISTRO_HRV UUID_TO_IGNORE
REGISTRO_FC REGISTRO_MEDIDAS android_metadata
sqlite> SELECT REGISTRO_MEDIDAS.ID_ACTIVIDAD as ID,date(ACTIVIDADES.FECHA) as ACTIV_DATE,SUM(CALORIAS) as Kcal ,REGISTRO_HRV.FC_REPOSO as HB_REST,round (log(REGISTRO_HRV.RMSSD) *15,1) as HRV,date(REGISTRO_HRV.FECHA) as HRV_DATE,REGISTRO_HRV2.FC_REPOSO as HB_REST2,round (log(REGISTRO_HRV2.RMSSD) *15,1) as HRV2,date(REGISTRO_HRV2.FECHA) as HRV2_DATE,REGISTRO_HRV3.FC_REPOSO as HB_REST3,round (log(REGISTRO_HRV3.RMSSD) *15,1) as HRV3,date(REGISTRO_HRV3.FECHA) as HRV3_DATE from ACTIVIDADES INNER JOIN REGISTRO_MEDIDAS on REGISTRO_MEDIDAS.ID_ACTIVIDAD = ACTIVIDADES.ID INNER JOIN REGISTRO_HRV on date(REGISTRO_HRV.FECHA) = date(ACTIVIDADES.FECHA, '+1 day') LEFT JOIN REGISTRO_HRV AS REGISTRO_HRV2 on date(REGISTRO_HRV2.FECHA) = date(ACTIVIDADES.FECHA, '+2 day') LEFT JOIN REGISTRO_HRV AS REGISTRO_HRV3 on date(REGISTRO_HRV3.FECHA) = date(ACTIVIDADES.FECHA, '+3 day') where ACTIV_DATE like '%2018%' GROUP BY date(ACTIVIDADES.FECHA );
Output
ID ACTIV_DATE Kcal HB_REST HRV HRV_DATE HB_REST2 HRV2 HRV2_DATE HB_REST3 HRV3 HRV3_DATE
---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------
81 2018-05-16 1483 59 64.7 2018-05-17 54 65.0 2018-05-18 58 64.7 2018-05-19
82 2018-05-19 4170 63 62.1 2018-05-20 58 64.3 2018-05-21 54 65.0 2018-05-22
85 2018-05-22 1832 65 60.8 2018-05-23 59 63.6 2018-05-24 57 64.1 2018-05-25
86 2018-05-28 1877 59 64.8 2018-05-29 54 63.7 2018-05-30 57 62.8 2018-05-31
87 2018-06-02 1921 57 63.9 2018-06-03 57 63.1 2018-06-04