Data in the table.
TYPE DATE
---- ----------
ZZ 1999-01-01
MF 2020-01-01
IK 2014-01-01
AC 2017-01-01
AC 1980-01-01
AB 2013-01-01
AB 2001-01-01
AA 1990-01-01
AA 1980-01-01
I want the above data in one of my tables to sorted and shown as below. It has to be sorted on the date first and then if there are more records for that type then I need to show that next as shown below. Can somebody help me in building the SQL to show the result as below. I tried using group by/order by but nothing is giving my result correctly.
Appreciate your help
.
I am running DB2 V 10 in Z/OS
Expected Output
----------------
TYPE DATE
---- ----------
MF 2020-01-01
AC 2017-01-01
AC 1980-01-01
IK 2014-01-01
AB 2013-01-01
AB 2001-01-01
ZZ 1999-01-01
AA 1990-01-01
AA 1980-01-01
TYPE DATE
---- ----------
ZZ 1999-01-01
MF 2020-01-01
IK 2014-01-01
AC 2017-01-01
AC 1980-01-01
AB 2013-01-01
AB 2001-01-01
AA 1990-01-01
AA 1980-01-01
I want the above data in one of my tables to sorted and shown as below. It has to be sorted on the date first and then if there are more records for that type then I need to show that next as shown below. Can somebody help me in building the SQL to show the result as below. I tried using group by/order by but nothing is giving my result correctly.
Appreciate your help
.
I am running DB2 V 10 in Z/OS
Expected Output
----------------
TYPE DATE
---- ----------
MF 2020-01-01
AC 2017-01-01
AC 1980-01-01
IK 2014-01-01
AB 2013-01-01
AB 2001-01-01
ZZ 1999-01-01
AA 1990-01-01
AA 1980-01-01