I'm building a simple login/registration feature, and I'm having a little trouble.
The issue is this, the user system I'm designing is supposed to accommodate different types of users, like (Blue users, Red users, Black users etc). So I was considering porting their different user data to separate database tables, and even giving them separate registration pages, because the content they would view on the site would vary depending on their color.
INSERT 'username' INTO `blue` where...
INSERT 'username' INTO `red` where...
"SELECT `id` FROM `blue`,`red` WHERE `username`...
One problem is probably that the "id" value is an auto-incremented primary key, right? Therefore it would be unique to only the table that they are in, but not over all tables (blue, red, black)
You would then always have to make sure to have unique usernames and ids over all groups or let them select what group they are when they log in and then only load data from that table.
If you have already solved the uniqueness problem, you should be able to simply use the union querys already suggested by other users. You can't use
blue, red, because that is short for
blue JOIN red, which of course will only result in data where columns with the same name are equal across blue and red.