can't determine proper JOIN query construct

You are viewing an old version of this question. View the current version here.

Hello, I have a newbie question: Running Mariadb 10.4, I'm using a baseball database containing 22 tables. All of the tables have a column named 'playerID'. What I'm trying to do is return results from two tables ('Batting' and 'Fielding') for a specific playerID (i.e. show the results for a specific playerID from both tables in one table) using a JOIN query. There are plenty of generic solutions on the net, but I have yet to find one that explains exactly what each segment of this query means. I thought this query would work, but apparently there's a syntax error:

select playerID from Batting, inner join Fielding on Batting.playerID = Fielding.playerID;

TIA for any help provided.

Regards,

Steve Silvi

Answer

The syntax error probably points you to the part of the query with the mistake. In this case, you have a comma after from Batting which shouldn't be there. See Joining Tables with JOIN Clauses for more examples.

Comments

Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.