0

I have different DB with the same tables each, and I need to group the information from those tables.

For example:

  • table orders db 1
  • table orders db 2

The idea in pseudo-code would be:

"SELECT * FROM orders(db 1), orders(db 2)"

Do you know an easy way to do this?

Cœur
  • 37,241
  • 25
  • 195
  • 267

1 Answers1

0

Can you not use traditional ANSI syntax?

"SELECT * FROM db1.orders Orders1, db2.orders Orders2"

I've not worked with Cakephp specifically, but if you want to do a cross join (which is horribly nonperformant btw, there are better ways to do it), thats the standard method.

PlantTheIdea
  • 16,061
  • 5
  • 35
  • 40
  • Yes I guess is something like this, but at the moment I don't get to do it with Cakephp. – Albert Maristany Oct 17 '13 at 07:11
  • this might help => http://stackoverflow.com/questions/806650/how-do-i-write-a-join-query-across-multiple-tables-in-cakephp. also, i HIGHLY doubt u actually want a cross join (which returns the cartesian product of all possible combinations of all rows). you might be thinking of a full outer join. – PlantTheIdea Oct 17 '13 at 12:20