in MYSQL, Joins are frightningly simple, and yet amazingly complex.
A normal select would be
SELECT * FROM table WHERE this=that
If you want to select from two tables, you can simply put:
SELECT * FROM table1,table2 WHERE this=that
But, what if "this" is a column in both tables?
So you have to specify which table you want "this" from:
SELECT * FROM table1,table2 WHERE table1.this=that
Now there is just one more problem;
when you JOIN tables, they are merged.
That means that if you only specify one WHERE clause for one column in one table, all the records from the other table are a match by default, just like SELECT * FROM table without any WHERE clause.
So this:
SELECT * FROM table1,table2 WHERE table1.this=that
will give all records in table2, for each record in table1 where this=that.
This is why tables in JOIN statements are usually "linked" like this:
SELECT *
FROM table1,table2
WHERE table1.id=table2.id
AND table1.this=that
Now the 'id' fields in both tables must have the same values AND table1.this must be 'that'
taht means that if there is only one record in table1 where this=that, the resultset will only contain those records of table2 that have the same id as table1 in the record where this=that.
hope you understand is a bit better now.