Complex Query over two Databases..

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Brian

    #1

    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(Marketing Source) as newvalue, marketingsource ,
    RTREDateRecorde d
    FROM ebluecard where month(RTREDateR ecorded) = month(Now()) and
    year(RTREDateRe corded) = year(Now()) group by Marketingsource


    This is the secondary query:
    select calcagnirealtim e.ebluecard.*, calcagniclientl ist.agents.*
    from calcagnirealtim e.ebluecard, calcagniclientl ist.agents
    where (calcagnirealti me.ebluecard.Cl ientRespectedAg ent <> 'Mike Smith')
    and (calcagnirealti me.ebluecard.Li stingAgent <> 'Mike Smith') and
    (calcagnirealti me.ebluecard.Cl ientCallAgent <> 'Mike Smith') and
    ((calcagnirealt ime.ebluecard.C lientRespectedA gent =
    calcagniclientl ist.agents.Agen tName) or
    (calcagnirealti me.ebluecard.Li stingAgent =
    calcagniclientl ist.agents.Agen tName) or
    (calcagnirealti me.ebluecard.Cl ientCallAgent =
    calcagniclientl ist.agents.Agen tName))

Working...