Professional Web Applications Themes

querying across databases on the same server - MySQL

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...

  1. #1

    Default querying across databases on the same server

    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

    laredotornado@zipmail.com Guest

  2. #2

    Default Re: querying across databases on the same server

    On 2 May 2007 15:06:44 -0700, com wrote: 

    Not according to any of the doenation I've seen. What problem is
    being solved by maintaining this stuff in separate databases?

    --
    With a Dremel tool and a cut-off wheel, _everything_ takes a flat-blade
    driver.
    -- Matt Roberds in the Monastery
    Peter Guest

  3. #3

    Default Re: querying across databases on the same server

    com wrote: 
    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 -- net
    To reply to me directly, delete "despam".
    lark Guest

Similar Threads

  1. Replies: 2
    Last Post: June 28th, 10:01 PM
  2. Querying NIS server
    By Kyle Tucker in forum Linux / Unix Administration
    Replies: 4
    Last Post: November 3rd, 09:52 PM
  3. Server hosts and databases
    By Minding in forum Macromedia Dynamic HTML
    Replies: 0
    Last Post: September 6th, 10:35 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139