>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


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

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to