Conversion of numeric to date and group by it.

Data Modeling
Enthusiast

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 :/

1 REPLY
Senior Apprentice

Re: Conversion of numeric to date and group by it.

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

cast(col / 1000000 - 19000000 as date)

Dieter