데이터을 순서대로 내나열하고자 하는데 어찌 해야 하는지요


현 쿼리 실행시 

    년계   

    전기누계

    종계

    01

    02

     *

     *

    12


원하는 순서

  전기누계

   01

   02

    *

    *

   12

  년계

  총계


해당 쿼리


SELECT  TICK_KIND AS '권종','<전기누계>', sum(TI_OUT)AS '불출', sum(TI_SALE)AS '판매', sum(TI_RE) AS '회수' 

FROM TBL_TICKSUM

where INOUT_DAY >='20000101'

   and INOUT_DAY <='20171231'

   and TICK_KIND='01' 


group by TICK_KIND



UNION



select TICK_KIND AS '권종', substring(inout_day, 1,6) '<월   계>', sum(TI_OUT)AS '불출', sum(TI_SALE)AS '판매', sum(TI_RE) AS '회수'

from TBL_TICKSUM

where INOUT_DAY >='20180101'

   and INOUT_DAY <='20181231'

   and TICK_KIND='01' 


group by TICK_KIND, substring(inout_day, 1,6)


UNION 


SELECT  TICK_KIND AS '권종','<년계>', sum(TI_OUT)AS '불출', sum(TI_SALE)AS '판매', sum(TI_RE) AS '회수'

FROM TBL_TICKSUM

where INOUT_DAY >='20180101'

   and INOUT_DAY <='20181231'

   and TICK_KIND='01' 


group by TICK_KIND



UNION 


SELECT  TICK_KIND AS '권종','<총계>', sum(TI_OUT)AS '불출', sum(TI_SALE)AS '판매', sum(TI_RE) AS '회수'

FROM TBL_TICKSUM

where INOUT_DAY >='20000101'

   and INOUT_DAY <='20181231'

   and TICK_KIND='01' 


group by TICK_KIND