Re: Need Help modifying this query
Posted: Wed Aug 20, 2008 11:06 am
This is a pretty straight forward statement, and one that should be easily enough written with proper data structures.cdoyle wrote:I want my users to be able to search for other players, and be able to filter out ones that are alive and ones that are dead.
This throws it off for me. Why would a player that is dead need to be placed into another table? Why wouldn't kill data be stored either in the players table or in a kill table that relates to the player table by that players ID? Then joining would be a snap. Even snappier if there were flags or other simple logic in place in the players table that would identify when a player is dead.cdoyle wrote:If a player is dead, their user ID gets entered into the medical ward table (along with some other info like what player killed them, and what weapon was used) the dead players id is stored playerdead_ID.
Under you current structure this would require two separate queries. One would hit the players table the other would hit the medical_ward table. Since the data structures are totally different for both tables you would literally need two different queries to pull what you want from either.cdoyle wrote:So basically, when a person searches.
If they select alive, it will bring back all the players not listed in the medical ward.
If they select dead, it will bring back those only listed in the medical ward.
Though looking at what you have now I would say that if a player is in the medical ward what you are really after is their information that lives in the players table that is related to them. Am I correct in that assumption?