Re: including the result of one query in another query
| From: | Jasper Bryant-Greene | Date: | Sun, 26 Jun 2005 23:08:32 +0000 |
| Subject: | Re: including the result of one query in another query | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-217662@lists.php.net to get a copy of this message | ||
Jochem Maas wrote:
>> I have two databases, on for aeromodelistas (aeromodelling) and
>> another for Códigos Postais (Postal Codes). I whant to do the
>
> what DB are you using? MySQL?
> you can't select across multiple DBs in any RDMS that I know of ...
> so it looks like either use 2 queries or merge the DBs?
I think he means tables. And yes you can, at least in MySQL, and
probably in others.
If you're using a version of MySQL prior to 4.1, though, you can't do
subqueries, which means that you'll need to reformulate your query with
joins.
Also DISTINCT isn't a function. The expression should be:
SELECT DISTINCT query_expr ...
not
SELECT distinct(query_expr) ...
Jasper