PDA

View Full Version : Queries to Multiple datbases...


outline
01-15-2000, 03:40 PM
This may be a pointless question as I can invision several problems that could arrouse, but is there a way to select records from mutiple tables in the same query?

For instance...

SELECT * FROM table1,table2 WHERE id=1

?
------------------

Justin
01-15-2000, 04:40 PM
Yes, this is called a table join :)

mysql> select users.name, users.email, orders.productname from users, orders where users.ID = orders.userID;

See http://www.devshed.com/Server_Side/MySQL/Join/ for a great tutorial that got me started with joins... I have some queries that I use regularly that are several lines long and involve 5 table joins... ;)[nbsp][nbsp]

------------------
Justin Nelson
FutureQuest Support
[This message has been edited by Justin (edited 01-15-00@3:41 pm)]