I have a table with these columns:
user ID, login time, logout time
When a user logs in if that user already has a row with a login time but no logout time then he relogs in using that row, otherwise it creates a new. The problem is sometimes the stored procedure runs twice and I get two entries.
Is there a constraint I can use for this situation to prevent it from being possible?