mysql join two tables bound on where clause

I would just like to start by saying Im learning SQL joins and although I’m progressing slowly I still have a lot to learn hench I turned here for help.

I’m trying to use the member number from a table called picks to retrieve member name from 2nd table called members

Both tables share same column namely namely member_nr.

Here are the two tables:

picks

enter image description here

members

enter image description here

The tricky part is im using a where clause in my query

Here is what I came up with following a tutorial from W3Schools unfortunately it does not cover adding WHERE clauses to joins…Perhaps this is because you can’t do it / should use an alternative method?

Select picks.pick, picks.score, members.name 
            FROM picks  
            INNER JOIN picks
            ON picks.member_nr = members.member_nr
            WHERE picks.tournament ='$accTour' AND picks.round='$accRound'

What I am tryng to accomplish

For the End Result I would like to display a table showing the following, as you might have guessed.

enter image description here

My Error

*Notice: Not unique table/alias:*

Any help will be greatly appreciated


Source: sql

Leave a Reply