I have a set of queries that represent the data from different sysdates (from the last 5, 7 and 30 days).
My doubt is how to express in a query this results in this matter:
STATE | 5 DAYS | 7 DAYS | 30 DAYS
---------------------------------
INIT | 1 | 1 | 2
---------------------------------
SECN | 2 | 2 | 2
NOTE: This is from a single table with different sysdates in consideration
NOTE2: An query example is this
select
CASE WHEN STATUS = 'INI' then 'Initial'
WHEN STATUS = 'SECN' the 'Second'
END 'Status', count(*)
from db.FilesTable
where 1=1
and DAT_Files >= DATEADD(day,-5,GETDATE())