I want to compare 2 dates and use CASE in WHERE to implement this logic:
if the end date is larger than
2016-06-30, the end date should be
However, I'm encountering an error. The error message is
My code is below:
select start_date, end_date, amount from info where case end_date when to_char(end_date, 'yyyy-mm-dd') > '2016-06-30' then to_date(to_char('2016-06-30'), 'M/D/YYYY') as end_date end order by end_date asc
Can you help me?