Expose my problem, I have two different tables 'user' and 'client'. I want to start storing each session attempt to statistical control. Table 'login_attempts' contains just who does the login, on what date and time and from that IP.
The problem is to relate the 'login_attempts' to 'user' and 'client' at a time to avoid creating a table 'login_attempts' for each entity table.
The problem is not the relationship itself, but that table discriminate both the stored identifier belongs.
I had thought about doing something like:
Table 'login_attempts' would store the identifier of the entity and also the particular register of the entity that performs at logon. In turn, each record of each entity would have a field that would store the identifier of the entity to which belongs (registered in another table) in order to discriminate between one or the other.
I do not know if there is a simpler way to do it and avoid data redundancy.
I do not know if I have explained well. Any help is good, thank you all.