-4

What is the difference in MySQL between:

SELECT * FROM A JOIN B ON A.item=B.item

and

SELECT * FROM A, B WHERE A.item=B.item

Ayman101
  • 15
  • 6
  • 2
    One uses proper, explicit, **standard** readable `JOIN` syntax. The other was obsoleted decades ago. – Gordon Linoff Apr 13 '20 at 19:02
  • 1
    Tip of today: Always use modern, explicit `JOIN` syntax. Easier to write (without errors), easier to read and maintain, and easier to convert to outer join if needed – jarlh Apr 13 '20 at 19:05
  • Please don't ask us to do your homework or research. This is a faq. Before considering posting please read the manual & google any error message or many clear, concise & precise phrasings of your question/problem/goal, with & without your particular strings/names & site:stackoverflow.com & tags; read many answers. If you post a question, use one phrasing as title. Reflect your research. See [ask] & the voting arrow mouseover texts. – philipxy Apr 13 '20 at 19:39
  • Does this answer your question? [In MySQL queries, why use join instead of where?](https://stackoverflow.com/q/2241991/3404097) – philipxy Apr 13 '20 at 19:42

1 Answers1

1

Multi FROM is similar to JOIN operation, you have to use WHERE clause to limit the rows returned. And it correspond to an implicit join.

But as you can read in comments, you should use explicit JOIN (OUTER JOIN, INNER JOIN, LEFT JOIN, RIGHT JOIN) that determine how the data is "linked" in ON clause.

  • 2
    This is obviously an easily found duplicate, please don't answer, flag it. It & another answer add nothing but clutter to the site & promote more. [ask] [answer] [help] – philipxy Apr 13 '20 at 19:43