Jump to content

Recommended Posts

I need to match the city and school in two tables (CONCAT) so I can determine whether or not they use the toggle column.  

Toggle is in a_schools

city and school are in both

The others are in a_players

 

(I'm sure someone will ask why a_players table doesn't have/use teamID, but it's not effective for my people (or me) to enter names.)

 

With LEFT JOIN it gives me the list I should get, 15 rows.  However, the toggles are all NULL.  Two should have "1".  

Here is the query:

 

SELECT nameFirst,nameLast,feet,inches,p.city,p.school,grade,position,grouping,rankPos,toggle FROM a_players p
					LEFT JOIN a_schools s ON CONCAT(p.city,p.school) = CONCAT(s.school,s.school)
				
					WHERE position ='3' AND grade='23' AND grouping ='2'
					ORDER BY rankPos

 

Link to comment
https://forums.phpfreaks.com/topic/310328-an-issue-with-join-two-tables/
Share on other sites

Sounds like there are no matching schools records - perhaps if you had CONCAT(s.city,s.school) instead of CONCAT(s.school,s.school) it may find matches.

or ...LEFT JOIN a_schools USING (city, school)

Edited by Barand
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.