Page 1 of 1

inner join returning incorrect results

PostPosted: 22. September 2018 23:31
by thedartgod
I truly hope this is in the correct place. I apologize in advance if I'm in error.

I've created this join:

SELECT teams.MemID, teams.Captain_flag, member.Email FROM member INNER JOIN teams ON member.MemID = teams.MemID WHERE SeasonID = 85 ORDER BY member.MemID ASC, teams.Captain_flag DESC

The teams table has 291 entries and the member has over 5500. When I execute it in phpMyAdmin it works: I get 291 results. When I execute from my php code I get 269 results. In addition to being 22 short, what I do get is not correct. I have not done an exhaustive search, but have found these 2 inconsistencies: (1) member 3143 is NOT in teams, but shows up in the join and (2) member 2068 is in teams 4 times but only shows up 3 times in the join.

Obviously, I prefer to use the join rather than access member 291 times.

Re: inner join returning incorrect results

PostPosted: 23. September 2018 01:00
by Altrea
Hi,

I don't have any idea how we can identify this issue without access to the data.
Phpmyadmin is executing SQL statements with PHP too, so there must be a different between your own method and the method phpmyadmin uses.

Best wishes,
Altrea

Re: inner join returning incorrect results

PostPosted: 23. September 2018 03:26
by thedartgod
Okay. Thank-you. I was going to offer you (or others) access to the data. But, in updating the online database, I discovered that the join works as expected. It seems the problem is within my local development version of the database.

On another matter. Is this the correct place for me to be posting this type of item?

dave race