Please can someone explain INNER JOIN ?
Posted: Sat Jan 30, 2010 2:30 pm
Hi all, just wondered if someone could please explain the INNER JOIN mysql query.
$query = mysql_query("SELECT nameid, productname
FROM people pe
JOIN skills s ON pe.nameid = s.nameid
JOIN products pr ON s.productid = pr.productid
WHERE pr.productname = '$produkt'");
This code is what a friend gave me in order to link 3 tables together. I have people, skills and products tables. the people table contain name and id, product table contain product name and id and the skills table just link people id to products id (many-to-many)
But am i interpreting this right ?
We can select * (everything from the 3 tables) or just some ?
pe, s and pr are just shorten for the different tables ?
and then once we get to the ON bit, then we link tables together ?
If im on the right track here, then i guess i dont need much more information, but just thought i would ask someone with more knowledge than me. also if you can come up with some more examples that would be GREAT !!!
Cheers everyone !
$query = mysql_query("SELECT nameid, productname
FROM people pe
JOIN skills s ON pe.nameid = s.nameid
JOIN products pr ON s.productid = pr.productid
WHERE pr.productname = '$produkt'");
This code is what a friend gave me in order to link 3 tables together. I have people, skills and products tables. the people table contain name and id, product table contain product name and id and the skills table just link people id to products id (many-to-many)
But am i interpreting this right ?
We can select * (everything from the 3 tables) or just some ?
pe, s and pr are just shorten for the different tables ?
and then once we get to the ON bit, then we link tables together ?
If im on the right track here, then i guess i dont need much more information, but just thought i would ask someone with more knowledge than me. also if you can come up with some more examples that would be GREAT !!!
Cheers everyone !