roger
|
| Posted: 06/04/2003, 7:43 AM |
|
Is there any way to pull data from two database connections using SQL. I have two connections in my project and need data from both to combine together.
|
|
|
 |
RonB
|
| Posted: 06/04/2003, 1:46 PM |
|
Ofcourse there is. Straight sql is a different thing though. It depends on what database you are using. With oracle you can setup tables in one database that get content from another database(oracle) from somewhere else.
If you mean can you do it within CCS without using any aditional non sql code.. no you cant. I have this on my wish list as well. If Yes could adapt the query builder to incorporate the different connections that would be great. I invision a statement looking like this:
select dbconnection1.sometable.somefield,dbconnection2.othertable.somefield from dbconnection1.sometable,dbconnection2.othertable where dbconnection1.sometable.somefield=dbconnection2.othertable.somefield
As it stands now you'll have to use your choice of programming language to do this. Use a before show event to get a value from one connection to use it in, for example, the where section of an sql statement for another connection
$db=new clsDBConnection1();
$db1=new clsDBCOnnection2();
$db->query("select something from somewhere where id=" .CCGetDBValue("select some_id from sometable",$db1));
I hope yes will find a way to use the query builder to cover statements over several connections. This would make CCS stand out from the croud even more and make it a very powerfull tool indeed!!
Ron
|
|
|
 |
ROGER
|
| Posted: 06/05/2003, 4:14 AM |
|
Thanks Ron,
I am using cold fusion and SQL Server. What I need to do is run a query on db based on a value in another db column.(If Then statement). I am tring to get a combined total based on the two databases.
|
|
|
 |
|