I am trying to get a list of records, grouped by client name within a given time period but am getting every single record rather than grouped records.
The data looks something like this:
ReqTS ClientName ItemID Outcome
2021-04-25 13:19:20:928 10.20.30.40 ABCD1 X0
2021-04-24 13:20:22:345 10.20.30.40 ABCD2 Y0
2021-04-26 13:21:35:456 10.20.30.40 ABCD3 X2
2021-04-25 13:18:45:589 10.20.40.50 ABCD4 Y1
2021-04-24 13:22:34:832 10.20.40.50 ABCD5 X0
I need to get:
2021-04-26 13:21:35:456 10.20.30.40 ABCD3 X2
2021-04-24 13:22:34:832 10.20.40.50 ABCD5 X0
I tried this but it returns all records:
select reqts, clientname,itemid, outcome
from reqresplog
where logdate <= to_timestamp('04/26/2021', 'mm/dd/yyyy') and logdate >= to_timestamp('04/24/2021', 'mm/dd/yyyy')
group by clientname,reqts,itemid, outcome
order by reqts desc;