I have a query here which gives me the login times of staff. I would like it to just show me the latest most recent one. Here I can get the past 30 days but it is too many rows.
select distinct sv.staff_name, ul.session_start, ul.session_end, ul.ip_address
from use_log ul
inner join staff_view sv on ul.staff_id = sv.staff_id
where datediff(dd,ul.session_start, getdate()) <=30
and ul.staff_id is not null