Answers for "group by row to column in oracle"

SQL
1

group by time oracle sql

/*     DANIEL MOMBEYNI      */
SELECT M.YYYYMMDD,
       M.HH24,
       M.HALF_PART,
  FROM (SELECT TO_CHAR(T.TIME_FIELD,
                       'yyyy/mm/dd') AS "YYYYMMDD",
               TO_CHAR(T.TIMESTAMP, 'HH24') AS "HH24",
               CASE
                WHEN TO_CHAR(T.TIME_FIELD, 'MI') BETWEEN 0 AND 30 THEN
                 '0-30 min'
                WHEN TO_CHAR(T.TIME_FIELD, 'MI') BETWEEN 31 AND 59 THEN
                 '31-59 min'
               END AS "HALF_PART"
          FROM TBL_NAME T) M
 GROUP BY M.YYYYMMDD, M.HH24, M.HALF_PART
 ORDER BY 1
Posted by: Guest on August-16-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language