I'm recording the time of the page visit by Emp_Id in SQL Server database.
My Visitors table contains the Emp_Id column (varchar) and the Last_Visited column, which is of datetime data type.
The primary key is on the ID column.
When an employee visits the page more than once in an hour, I would like to delete the new visits, and keep only the first one.
How can I write a query that takes care of this?
My pseudo code:
Delete multiple Emp_Id from Visitors where Last_Visited is less than 1 hour and keep the first Emp_Id only from that time frame.
I would appreciate your help.