While I don't think there's a 'good' way to do this, I think your approach might work. Say you have two Namespaces, A & B. You can link Ens.MessageHeader & Ens.MessageBody from B to A and then run the query:
SELECT <Fields> FROM Ens.MessageHeader WHERE (...)
UNION ALL
SELECT <Fields> FROM Ens.MessageHeaderB WHERE (...)
While this will work (technically) it is limited. You won't necessarily be able to JOIN, ORDER, or GROUP the results in a meaningful way, and so you will need to write some additional code to do this. That said, you could certainly write a stored procedure to handle this situation if you so chose. The stored procedure here is more in line with what Dave L. said - you need to write code to merge the results. But if you don't care about order and you think you're only going to get a small number of messages back, no reason this can't work.
- Log in to post comments