Forum Moderators: coopster

Message Too Old, No Replies

same server 2 DB 1 query

How may I query from A db and B db

         

henry0

11:00 pm on Jul 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello
I have 2 DBs on the same server for ex: DB1 and BD2
both are related to only one website (PHP MySQL driven)
A new page is needed and I figured that I need to query for echo-ing results in the same new page a combo of the 2 DBs.
How may I write that query?

for example in db1 I need to query "ID" and from db2 "users"
of course this is not the real query
(it would not make sense!)
I may write 2 queries but I would like to know if I can get results from both DB by using only one query
Thank you

Regards

killroy

11:12 pm on Jul 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



like this:

SELECT
t1.id,t2.user
FROM db1.table1 AS t1,db2.table2 AS t2
;

SN

henry0

12:13 am on Jul 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Kiilroy,
thank you
that will do fine!