SELECT table1.PrimaryKey(Some ID), table2.nameOfSomething
FROM table1
INNER JOIN table2
Here is the part i don’t get :
USING(id)
this ID is table1 foreign key, and table2 primary key
i dont really get it..
table1.ID values:
25 Rows:
row 1-5 = 1 , row 6-10 = 2 , row 11-15 = 3 , row 16-20 = 4 , row 21-25 = 5
table2.ID values :
5 Rows:
row 1 = 1 , row 2 = 2 , row 3 = 3 , row 4 = 4 , row 5 = 5
i test it and i get different result without it, how comes?
Note : Table1 contains interests, Table2 contains categories for these interests
feel free to ask for more information
If you join the above two tables together with
USING(id)it will match rows where theidvalue inTable1are the same as theidvalue inTable2…But, the
idinTable2might have nothing to do with theidinTable1. If that’s the case, you can useONto be specific about how you match records together…If you specify nothing at all, you match every record in one table, against every record in the other table…