Hello,
in SSMS:
My database has 3 columns . I can get the timestamp column OK, but I get stuck when trying to retrieve the rest of the record
This code works to get only the timestamp:
Code:
select min([timestamp]) as T2
from dbo.NM_Data where timestamp between '2020-01-01 00:00:00' and '2023-10-02 00:00:00'
group by DATEpart(year, [timestamp]),
DATEpart(month, [timestamp]),
DATEpart(day, [timestamp]),
DATEpart(hour, [timestamp]),
(DATEpart(minute, [timestamp]) / 15)
order by T2;
I tried a few things that didn't work - I get aggregate errors.
How do I get col2 & col 3 into the query too??
Code:
col 1 col2 col3
10/15/2022 9:15:10 PM 8 A
10/15/2022 9:30:10 PM 6 A
10/15/2022 9:45:10 PM 3 C
10/15/2022 10:00:10 PM 9 B
Thanks