I am implementing a query where I can obtain the data for each week. For example, I am with week 01 , which would be between 12/31/2018 and 01/06/2019 .
Check by passing the date manually:
SELECT FECHA_MUESTRA DIA,
LABEL,
DL_OUT_TH_KBPS,
ROUND ( (DL_OUT_TH_KBPS + UL_INC_TH_KBPS) / (1000 * 1000), 2)
TOTAL_DL_UL_GBPS
FROM V_GF_DATA_GW_TH_KBPS
WHERE FECHA_MUESTRA >=
TO_DATE ('31/12/2018 00:00:00', 'dd/mm/yyyy HH24:MI:SS')
AND FECHA_MUESTRA <=
TO_DATE ('06/01/2019 23:59:59',
'dd/mm/yyyy HH24:MI:SS')
ORDER BY FECHA_MUESTRA DESC, label DESC
This works well for me, it brings me all the records would be 2016
Query extracting automatically:
SELECT FECHA_MUESTRA DIA,
LABEL,
DL_OUT_TH_KBPS,
ROUND ( (DL_OUT_TH_KBPS + UL_INC_TH_KBPS) / (1000 * 1000), 2)
TOTAL_DL_UL_GBPS
FROM V_GF_DATA_GW_TH_KBPS
WHERE
FECHA_MUESTRA >= trunc(sysdate,'iw')-7
AND FECHA_MUESTRA <= trunc(sysdate,'iw')-1
ORDER BY FECHA_MUESTRA DESC, label DESC
This query only brings me a total of 1729
From what I see it is not bringing me the ones from the last day "01/06/2019"
In the manual query you have written this time "23:59:59" and
trunc(sysdate,'iw')-1
it brings you this other "00:00:00". To avoid this change the comparison like so:AND FECHA_MUESTRA < trunc(sysdate,'iw')