I have two different type users table. One of them is ordinary user table for registered users. Other one is for unregistered users. I need to use these two tables with other tables. For example;
registered_users: userid, username, password, name, sex, email, ip
unregistered_users: userid, name, sex, ip
some_table: id, title, content, userid
How can I join some_table with user table?
I have some oppinion but none of them does not feel right.
- use all table regUser column and unRegUser column with null values and join two table etc. This way non suitable because all tables have lots of null cell.
- if all table like some_table add a column userType and each query has "if". But this way is long and spends resources.
- if userid column type will be string (r13, u32 - r:registered, u:unregistered) and use "substring" and "if" but this is more difficult
- create a connection table like "id, type, userid" and use this id instead of userid. but also need "if"
- create a connection table like "id, regUser, unRegUser" with null values.
Or create a different user table to be combine of two user tables. Of course we have null columns again.
You think which way is the best? Or any one has different opinion.