Note that foreign keys in SQL are not used to join tables, but are used
mostly for checking referential integrity (foreign key constraints). If you
want to get results from multiple tables from a SELECT statement, you do
this by joining tables:

SELECT * from table1,table2 where table1.id = table2.id;

or use alias

SELECT t1.ID, t2.Name from table1 t1, table2 t2 where t1.id = t2.id

ChrisB

-----Original Message-----
From: GERARDO GALLARDO [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 26, 2001 3:57 PM
To: [EMAIL PROTECTED]
Subject: STUPID QUESTION


I'm new to MySQL and SQL in general.  I have been searching and searching
but I can't find an answer to a question which I know is simple.  I have
read a book called Teach Yourself MySQL in 21 days.  It talkes about
defining relationships between tables but it never actually shows you how
you would create these relationships or reference data from one table in
another table.  How do I do this?  Please help.
Gerardo

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to