i am struggling to find a solution about how to form a specific select statement. I have a table with 3 columns and the values bellow:
id | name | gender
1 | John | M
2 | Andrew | M
3 | Peter | M
4 | Kim | W
5 | Mary | W
6 | Tim | M
I wish to select them in a way that after a Male (M) comes a Girl (W) and then again a Male (M) etc and then, when there are no other W the remaining data in any order ... something like: John (M), Kim(W), Andrew(M), Mary(W), Peter (M), Tim(M). I know i could load them via php into a table and do this, but the db table is huge and this would take up proccess time.
Is there a way to do this in pure MySQL as Select statement?
Wow, i never thought this is that difficult