SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: SELECT across 2 Databases

  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2003
    Location
    Germany
    Posts
    87
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    SELECT across 2 Databases

    Hi

    I´m trying to select data from 2 databases within a server.
    The user has the correct right to access both databases.

    I used

    Code:
    SELECT 
      db1.tab1.id,
      db2.tab3.name
    FROM
      db1.tab1,
      db2.tab3
    and

    Code:
    SELECT 
      table1.id,
      table3.name
    FROM
      db1.tab1 AS table1
      db2.tab3 AS table3
    But both times I get: #1103 - Incorrect table name 'db2.tab3', but it is spelled correctly.

    Where is my mistake?

  2. #2
    reads the ********* Crier silver trophybronze trophy SitePoint Award Recipient longneck's Avatar
    Join Date
    Feb 2004
    Location
    Tampa, FL (US)
    Posts
    9,854
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the first query simply isn't supported by mysql, and the second query is missing a comma.

  3. #3
    SitePoint Enthusiast
    Join Date
    Oct 2003
    Location
    Germany
    Posts
    87
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by longneck
    the first query simply isn't supported by mysql, and the second query is missing a comma.
    Sorry, I´ve forgotten the comma while posting it.

    But I found out, that it was because of the ` at the FROM `table`, if I don´t use ` it works fine.

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
  •