SELECT   Max(price) AS "MaxPrice",
         type,
         Date_format(From_unixtime(transaction_ts),'%Y') AS year,
         Date_format(From_unixtime(transaction_ts),'%m') AS month,
         Date_format(From_unixtime(transaction_ts),'%d') AS day,
         Date_format(From_unixtime(transaction_ts),'%H') AS hour
FROM     crawler_stockdata
GROUP BY (type, Date_format(From_unixtime(transaction_ts),'%Y'), Date_format(From_unixtime(transaction_ts),'%m'), Date_format(From_unixtime(transaction_ts),'%d'), Date_format(From_unixtime(transaction_ts),'%H'), symbol)
order BY date_format(from_unixtime(transaction_ts),'%Y'),
         date_format(from_unixtime(transaction_ts),'%m'),
         date_format(from_unixtime(transaction_ts),'%d'),
         date_format(from_unixtime(transaction_ts),'%H')