View Single Post

   
  #3 (permalink)  
Old 02-28-2008, 09:44 AM
lark
 
Posts: n/a
Default Re: querying across databases on the same server

laredotornado@zipmail.com wrote:
> Hi,
>
> I'm running MySQL 5.0 on Linux. I have created three databases on
> localhost, all accessible by the same user. The names of the
> databases are USER1, USER2, and SUPER_USER. Databases USER1 and USER2
> have the following table:
>
> YEARLY_SALES
> -------------------------
> YEAR INTEGER,
> SALES FLOAT UNSIGNED
>
> Is it possible to write a single query to list sales for the year 2007
> for both USER1 and USER2?
>
> Thanks, - Dave
>

yes, you can qualify your sql statement with database name. for example
you can write a stored procedure that does this and save it in super_user!

--
lark -- hamzee@sbcdeglobalspam.net
To reply to me directly, delete "despam".
Reply With Quote