Re: join across databases - how to select databases?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Moshe Weitzman" <phpnntp.20.weitzman@spamgourmet.org>


> I have looked all over the web but can't find an example *in php* for
> connecting to a mysql server, selecting database(s), and issueing a query
> which joins across databases. I already know the SQL required to achieve a
> multiple database query. My question is about how many calls to
> mysql_select_db() are required, does order matter, etc.

What have you tried? What does mysql_error() say after each attempt?

I assume something like the following would work, regardless of whether/how
you've called mysql_select_db()

SELECT t1.column FROM database1.table1 t1 JOIN database2.table2 t2 ON t1.id
= t2.id

If you have something working from the MySQL command line, then it's going
to work from mysql_query() with the same exact syntax.

---John Holmes...


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux