Hi, thanks for your reply. I would use DB::query() if I didn't need Pagination. ParseQueryLimit() doesn't work with DB::query(), so I think I Have to use SQLQuery(). And a JOIN won't work because these DataObjectManager-created tables have No relationship to SiteTree. And HAVING, well, I don't know how that would work. Further ideas?
There are a few issues here. Firstly, if you have disparate objects, you have the potential for ID collisions which SilverStripe is not going to like in certain situations. Secondly, it isn't even clear how you paginate over a unioned dataset. Consider the differences between:
(SELECT ID FROM MyObject LIMIT 5) UNION (SELECT ID FROM MyOtherUnrelatedObject LIMIT 5)
(SELECT ID FROM MyObject UNION SELECT ID FROM MyOtherUnrelatedObject) LIMIT 5
Basically, to keep it stable you'll have to write the sql and handle the pagination yourself. You could also try merging two dataobject sets, eg: