Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
i have a master table which has
yearmonth as 201612
and another table yearmonth as dec 2016
need to join the to tables on id and this monthyear flag
but both date are in different format (they are string values)
how to convert and den join these two tables.
Try below functions to convert them into date.
1. Date(Date#(yearmonth,'YYYYMM')) as NewyearMonth
2. Date(Date#(OtherDate,'MMM YYYY')) as NewOtherDate
Now you can use this fields to link each other.
Regards,
Kaushik Solanki
its in string format so this function doesn't work directly
Hi, Try the below code. This may help in converting the yearmonth format from 201612 to Dec 2016
Date1:
Load * inline [
Date_1
201612
201601
201602];
Date2:
Load * Inline [
Date_2
Dec 2016
Feb 2016
Jan 2016];
--------format date from Date1 alongwith your other column
load Date(Date#(Date_1,'YYYYMM'),'MMM YYYY')
Resident Date1;
Try this - this will convert Dec 2016 to 201612
this may be helpful as well
Date(Date#(Date_2,'MMM YYYY'),'YYYYMM')
so shud I do a left join
or just load table,beacuse it will hve synthetic keys two common columns are there
how to approach for this data model
kndly help