Complex Query over two Databases..

Can someone please help me combine these two queries? Basically, there
are 3 columns in the ebluecard table that refer to agent. I need to do
this first query, but filter by the office which is in the agents table
in a different database. Is this possible?

This is the main query:
SELECT count(MarketingSource) as newvalue, marketingsource,
RTREDateRecorded
FROM ebluecard where month(RTREDateRecorded) = month(Now()) and
year(RTREDateRecorded) = year(Now()) group by Marketingsource


This is the secondary query:
select calcagnirealtime.ebluecard.*, calcagniclientlist.agents.*
from calcagnirealtime.ebluecard, calcagniclientlist.agents
where (calcagnirealtime.ebluecard.ClientRespectedAgent <> 'Mike Smith')
and (calcagnirealtime.ebluecard.ListingAgent <> 'Mike Smith') and
(calcagnirealtime.ebluecard.ClientCallAgent <> 'Mike Smith') and
((calcagnirealtime.ebluecard.ClientRespectedAgent =
calcagniclientlist.agents.AgentName) or
(calcagnirealtime.ebluecard.ListingAgent =
calcagniclientlist.agents.AgentName) or
(calcagnirealtime.ebluecard.ClientCallAgent =
calcagniclientlist.agents.AgentName))
Brian Ciarcia [ Fr, 16 Juni 2006 21:30 ] [ ID #1357861 ]
Datenbanken » mailing.database.mysql » Complex Query over two Databases..

Vorheriges Thema: multiple database select
Nächstes Thema: default field values