I have two tables with the following data
table "group1":
id | sequenceNo
----+-----------
101 | 1
102 | 2
103 | 3
104 | 4
105 | 5
table "group2":
id | sequenceNo
----+-----------
201 | 1
202 | 2
203 | 3
204 | 4
205 | 5
I have a given ration of 3:1 which should build a mix of the groups.
The result would be:
id
--
101
102
103
201
104
105
Ideally the mixing stops when one of the groups is empty.
I've implemented a solution for the problem as an OO-program. However, I am curious if there is also a simple SQL-only solution.
Many thanks,
Maik
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire