Converting YYYYWW into YYYYMM in SQL

37 Views Asked by At

Trying to retrieve MONTH info of the WEEK ,

Input data is in YYYYWW format, output data is YYYYMM format. Both datatype is INTEGER .

When the week spans in two consequitive months, month of Monday will be considered.

Here is the example:

input_yyyyww output_yyyymm
202401            202401
202402            202401
202403            202401
202404            202401
202405            202401
202406            202402
202407            202402
202408            202402
202409            202402
202410            202403
202411            202403
202412            202403
0

There are 0 best solutions below