View Single Post
Old 03-07-2013, 11:28 PM   PM User | #6
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,178
Thanks: 59
Thanked 3,995 Times in 3,964 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
Quote:
The username is being used as the foreign key in the team_member_scores table
Ummm...no, it is not. At least not in your query.

And that's surely the problem.

Foreign keys are *NOT* automatically used in queries. Ever. They *MUST* be explicitly specified in the JOIN or they will be ignored. A foreign key DECLARATION in the table is only useful for preserving data integrity, not for queries.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote
Users who have thanked Old Pedant for this post:
Bob Fo (03-08-2013)