Sounds like there are some important details about how your database is structured that are being left out...
I'm
assuming, this is what you have...
Code:
users
--------------
...
userid,
languageid,
...
transactions
--------------
...
statusid,
...
statuses
--------------
statusid,
code,
languageid,
description
What you may want to consider doing, is using the composite key described before for your status table and get rid of
statusid. Then change
transactions.statusid to
transactions.status_code. Now, when you want to get the display name for a transaction status, use
user.languageid and
transaction.status_code to create the key for the statuses table.
Quote:
|
Seems like an idea but then, what's the purpose of storing the LanguageID in the transaction table? Just for the FK purpose? Is there any way I can do away with storing the LanguageID in the transaction table?
|
A transaction should know nothing about the language its status is in. It should only know if it is active, inactive, etc. The language only matters to the user.
So a step in the right direction would look something like:
Code:
users
--------------
...
userid,
languageid,
...
transactions
--------------
...
status_code,
...
statuses
--------------
status_code,
languageid,
description
with
transactions.status_code (FK) -> statuses.status_code
users.languageid (FK) -> statuses.langaugeid
and those two fields making up the primary key of the statuses table.
Does that help at all...???
P.S. you may want to consider reworking this part of your database design.