I have a table with hit statistics for some items in another table.
This table is defined like this
ID (Primary key)
ItemId (Foreign key)
Date
Hits
Giving me have a record pr. item pr day.
The database is used in a multithreaded environment, so two users might make the first hit at the same time causing two records to be created, where I want only 1 with hits=2. (because of a unique index I would get an exception instead)
How do I ensure that I only have one record pr. item pr. day?