Hey.
The problem with linking tables in that manner (listing them after the FROM clause) is that the tables are linked without any specific relationship between them. Meaning that
every row in every table is linked to every row in every other table, giving you a massive table that you can't filter by any one column in any one table without getting every possible row from all the other tables.
To avoid this, you should define the relationship between the tables, like chathura86 suggested. However, I would suggest that you use the ON clause, rather than defining it in the WHERE clause. This will have MySQL link only rows that match a specific condition, like if a column in one table is equal to a column in the other table.
For instance, if I had a "product" table, which linked to a "category" table by a foreign key, I could do this to list all products by the name of the "category".
- SELECT * FROM product AS p
-
INNER JOIN category AS c
-
ON p.category_id = c.id
-
WHERE c.name = 'Boat'
This would give me only products who's "category_id" matches the "id" of a category named "Boat"