[ale] Selecting from multiple tables

Grant Robertson me at grantrobertson.com
Mon Oct 3 09:21:37 EDT 2005


True, but as he said already, this isn't a join. This is more, uh,
concatenation. I don't think it's possible at least not within the
result set itself. To truly do what Christopher needs to do here, the
only way I see would be to add a field to each table, set the new
field for all the rows in each table to some value representing the
department , select * from table1 into newtable, repeat for each
table.. then select * from newtable order by blah. (Can you do select
... into ... in mysql?).

I'm sure this isn't the answer Christopher wants, and I'm sure who
ever modeled the data had a good reason at the time for storing it
that way. What that good reason may have been, I shudder to think.

The basic rule would be, if you have to think this hard to select the
data you need then the schema is the reason, not the engine.
-G

On 10/3/05, George Carless <kafka at antichri.st> wrote:
> Wrong - you can do joins across multiple databases running on the same
> MySQL server; e.g. select * from db1.users inner join db2.groups on
> users.group_id = groups.group_id ...



More information about the Ale mailing list