List:General Discussion« Previous MessageNext Message »
From:Peter Brawley Date:June 24 2006 10:38pm
Subject:Re: selecting data from 2 local DBs with same table structure
View as plain text  
 >I need the query to select the data from table1 on db1 and then select 
the
 >data from table1 on db2 and return a result of where if a field data 
value
 >is found in both tables that matches on name for example, it would 
count the
 >occurrences.

Not entirely clear. Do you mean ...

SELECT
  name,
  COUNT(field) AS Count1,
  (SELECT COUNT(field) FROM db2.tbl2 WHERE db2.tbl2.name=db1.tbl1.name) 
AS Count2
FROM db1.tbl1
GROUP BY name;

?

PB

-----

Cx Cx wrote:
> Hello List!
>
> Does anybody know how to select and build a result set from two or more
> databases with the same table structures that are on the same server.
>
> I need the query to select the data from table1 on db1 and then select 
> the
> data from table1 on db2 and return a result of where if a field data 
> value
> is found in both tables that matches on name for example, it would 
> count the
> occurrences.
>
> Thanks in advance
>
> Craig
>
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.394 / Virus Database: 268.9.3/374 - Release Date: 6/23/2006
>   

Attachment: [text/html]
No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.394 / Virus Database: 268.9.3/374 - Release Date: 6/23/2006
Thread
selecting data from 2 local DBs with same table structureCx Cx24 Jun
  • Re: selecting data from 2 local DBs with same table structurePeter Brawley25 Jun
    • Re: selecting data from 2 local DBs with same table structureCx Cx26 Jun