All Forums Data Modeling
wicik 35 posts Joined 06/12
19 Mar 2013
Conversion of numeric to date and group by it.

Hi there...
I'm pretty nobbish in this type of SQL so please try not to be rough for me :)
Well.. I have to convert numeric field to date, than count some upload data and group by table.
Numeric_column like 20121121133549 which is probably like YYYYMMDDHHMMSS
Other columns are acces_point_type and data_uplink.
My goal is to convert numeric to Date (without time HHMMSS), count data_uplink and group by acces_point_type.
Simple group by would not be that problem but whole idea of convert data and connect it with casted date format and group by this,  is pretty dark magic for me.
Any help would be appreciated.
PS: Sorry for my terrible English :/

dnoeth 4628 posts Joined 11/04
19 Mar 2013

This should work, extract the date portion and modify it to match the internal storage:

cast(col / 1000000 - 19000000 as date)



You must sign in to leave a comment.