Relations(I think)

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
bjugis
Forum Newbie
Posts: 6
Joined: Fri Nov 29, 2002 5:08 am

Relations(I think)

Post 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.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post 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
Post Reply