Different User IDs for Same Date, but Not Same User ID for Same Date

Heatshiver

Registered User.
Local time
Tomorrow, 00:23
Joined
Dec 23, 2011
Messages
263
I have two tables, a tblUsers and a tblDailyReport.

The tblUsers only stores a User ID. The tblDailyReport stores both the Date and the User ID. I have a relationship from tblUsers to the User ID on tblDailyReport. tblUsers has its primary key set to User ID. While tblDailyReport currently has no primary key.

When I use it this way I can have a User ID use more than one date. The issue here is that I can also have the User ID use the same date numerous times and have it stored in the tblDailyReport, creating multiple records for the same User ID and date.

If I make the Date in tblDailyReport a primary key, I can only use one User ID per date.

I need to ultimately have the same date but for different User IDs. However, I can't have duplicate records of the same date and User ID. What can I do to fix this?
 
hi,
make userid and date as primary key in tblDailyReport.

this will fix your problem

enjoy
 
Thank you rammudali! I had thought about a compound index key, but I didn't think that would work!
 
hi,
I think at table level this is the only solution available.

if any other solution availabe, let me also know
 

Users who are viewing this thread

Back
Top Bottom