Complex Query over two Databases..
am 16.06.2006 21:30:09 von Brian CiarciaCan 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))