Jump to content

Query duplicate results


Caffeinenyx

Recommended Posts

$PlayerQuery = "SELECT FirstName, SurName FROM players p, rounds m, entrants e, games t WHERE p.PlayerID = e.PlayerID AND m.GameID = '$ID' AND e.EntrantID = m.Player";
	$PlayerResult = mysql_query($PlayerQuery);
	$PlayerRow = mysql_num_rows($PlayerResult);

 

Can someone suggest why this returns game*the number of results. For each new game it returns an extra duplicate result. For example for 2 games:

j Smith

j Smith

t John

t John etc

 

There are no duplicate entry's! and results should be unique.  Not in a loop (positive)

Link to comment
Share on other sites

Because your pulling 2 rows, for example

if i have 2 tables

Table A has 1 record

Table B has 3 records

 

if i link them and display only for table A i would get the same result 3 times,

change FirstName, SurName  to * and review the details,

without knowing my details about the database its kinda hard to say!

but it's likely you are returning 2 more data that you need/want

Link to comment
Share on other sites

* still returns game* results. First name etc is unique to rounds. Also none of them have the same number of results as game except game. Why game* results. It should only be looking a 1 game ID, which has say 8 people and  entry ID's, hence 8 names.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.