The approach by Charlieface is an interesting one. However, it does not address the fact that the number of time intervals (3 in that case) are hardcoded.
Using a stored procedure with a parameter, such as @nTimeInterval = 3 (and a default value of 1) could work.. This code could be modified as such:
select
tabnm,
rundt,
rec_cnt
from audit_tbl
where rundt IN (
EXEC Procedure @nTimeInterval = 3;
)
and tabname = 'emp'