Quote
Your suggestion means I have to bin that and have 5 rows per id in one table and 2 per id in the second table ...
Yep! That's right.
Quote
... which makes the id not unique and will be duplicated on several rows.
So what? Do you ever
need to access ID #16659352956492, which happens to be ball #3 from the draw made on the 02/04/06? (Whenever
that is?)
I would be surprised if you did.
These groups of rows exist as "units"; you wouldn't have three of them without the rest, but they're structured in a way that better suits your database server, which is important if you worry about Performance. With hundreds of rows, it'll manage - with millions, I suspect it would struggle.
You're
most of the way there to joining one query to another.
Those
brackets that you have wrapped around all those union'ed selects are one part of it; adding a "table alias"
to that bracketed sub-expression is the second.
select t0.*, t1.*
from
( select *
from ...
) t0
inner join
( select *
from ...
) t1
on t0.? = t1.?
Replace each select above with your existing queries and change the "on" clauses to join them appropriately.
Regards, Phill W.