Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connect databases

Status
Not open for further replies.

richtestani

Instructor
May 3, 2004
20
0
0
I have tables from 2 databases I would like to join. I was trying stuff out but not getting any errors. Is this a valid statement?
Code:
SELECT * FROM movieinfo.moviedb LEFT JOIN dvdinfo.dvddb ON movieinfo.id=dvdinfo.movieid WHERE movieinf.title="a";
I am not getting an error but also not getting results.

The idea is, My movie info is in its own database, this is so I could setup other site db's and each site can have it's own type of movie data. The dvddb has a table with movie id references. Is this possible anyway?

Thanks
Rich
 
That doesn't quite make sense.
Is movieinfo a database or a table?

[tt]SELECT * FROM movieinfo.moviedb[/tt] says that it's a database.
[tt]ON movieinfo.id=dvdinfo.movieid[/tt] says that it's a table.

I can't understand how you weren't getting errors there.


-----
ALTER world DROP injustice, ADD peace;
 
movieinfo is a table of moviedb and dvdinfo is a table of dvddb

I want to join movieinfo with dvdinfo.

I am not sure, if I can, how to join tables from different databases.
 
You can certainly join tables from different databases. You would need to change your SQL though:
[tt]
SELECT *
FROM
moviedb.movieinfo
LEFT JOIN dvddb.dvdinfo ON movieinfo.id=dvdinfo.movieid WHERE movieinfo.title="a";
[/tt]


-----
ALTER world DROP injustice, ADD peace;
 
Tony, Thanks for your help - This did it!
Wooo hooo!

Rich
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top