Sorting of columns in alternative order. [message #681447] |
Sat, 18 July 2020 12:58  |
 |
pavansivaece@gmail.com
Messages: 1 Registered: July 2020
|
Junior Member |
|
|
Hello All.
I have a table with Gender as a column having values (M & F) inserted randomly in it.
I want to sort the records in alternative way where M comes first followed by F and followed by M
Output should be
M
F
M
F
M
F
Could anyone pls suggest me a sql query which return the records in above sorted order.
create table t3 (GENDER char(1));
insert into t3 (GENDER)
values ('M');
insert into t3 (GENDER)
values ('F');
insert into t3 (GENDER)
values ('M');
insert into t3 (GENDER)
values ('M');
insert into t3 (GENDER)
values ('F');
insert into t3 (GENDER)
values ('F');
|
|
|
|
|
|
|