Page 1 of 1

Relations(I think)

Posted: Fri Nov 29, 2002 6:13 am
by bjugis
How does relations work in mysql?
Isn't to get data from 2 different tables in one quary?
What is the syntax. Don't find it in php manual.

Posted: Fri Nov 29, 2002 6:16 am
by twigletmac
Try the MySQL manual:
http://www.mysql.com/doc/en/SELECT.html

There's an example of a query pulling data from two tables on that page.

Code: Select all

mysql> SELECT t1.name, t2.salary FROM employee AS t1, info AS t2
    ->        WHERE t1.name = t2.name;
mysql> SELECT t1.name, t2.salary FROM employee t1, info t2
    ->        WHERE t1.name = t2.name;
Mac