I need to write a join query on two tables where in I need to join the tables on two dates, however the format of the dates is different. In one table the format of the date is in DATE format e.g 2008-05-06 and the other table has date in format as '06MAY2008' (CHARACHTER (9)).How do I do the comparison? Thanks in Advance.
Joined: 13 Feb 2004 Posts: 551 Location: Bangalore
SELECT * FROM TABLE A WHERE DATE_COL IN
WHEN 'JAN' THEN '01'
WHEN 'FEB' THEN '02'
WHEN 'MAY' THEN '05'
FROM TABLE B
Change '06MAY2008' with your date column in table B.
IMO the DB design could have been done in a better way.