How do you update LastActivityDate column? Do you update it every time the user access the table? If you do, just update the hits every time you update the LastActivityDate column.
Something like:
-
-
UPDATE Users
-
SET Hits=Hits+1,LastActivityDate = getdate()
-
WHERE UserName = VariableFromYourSite
-
-
.
Your options are:
Create a stored proc that will handle all this
or
Build the query from your front end and execute dynamically.
--CK