In a recent post, I shared code on how to change timestamp format from one style to another. Today, we do similar tweaks for date formats, as I had to do comparison between dates having different formats, on either side of operand in WHERE clause.
Trick 2 Compare Diff Formats..
Suppose, your table has a column having format ‘YYYY-MM-DD’ and you have to do comparison with a column having this format ‘YYYYMMDD’.
SEL * FROM SOME_TBL WHERE CAST( CAST( YYYY_MM_DD_CLMN AS CHAR(10)) AS INTEGER) = YYYYMMDD_CLMN
Hope this helps..