tags:

views:

34

answers:

1

Hi,

I have two tables for a facebook and twitter stream. Those tables have to be separated, so there's no point merging them into one table. But here's the thing. I want to have all the results from those two tables merged into one result and I cant seem to figure out how to get that working.

Oh, and it has to be fast. I read something about merging multiple tables into one table and then getting the results from that but that doesn't seem fast enough for me.

Should I do it in PHP and MySql or can it be done just in native MySql (preferred).

The results will be ordered by date which is saved in both tables.

Can anyone help me, or point me in the right direction?

Thanks!

A: 

Have you had a look at

UNION ALL

astander
Thanks for the fast response. That's what I was looking for. But it's not possible to use the primary key of each table. Only the first tables primary key is shown. Any ideas? PS: They both have a different name e.g. facebook_id and twitter_id.
frietkot