It sounds like you're trying to get a sorted list of items from multiple unrelated tables.
In that case I would get the messages from each table individually and then in C++ programmatically sort them into the order you desired. That might make your queries much less complex than having them do the union and sort across many tables.
EDIT:
Unfortunately I don't think there is an absolute objective answer as to whether to do this in SQL or programatically in C++. I would suggest a pragmatic approach: Code it the way that's easiest and most clear (usually the two are the same) and see how it performs. If performance is acceptable then you're done. If it's slow, then profile it. If you discover your method is the slow point then you can try the other approach and see how it performs instead.