sql - How to compare with date in mm/yy format in MySQL? -
i have column named 'exp_date' , date mm/yy. i.e: 07/17. want select rows exp_date less or equal 2 months remaining today. how can this?
you need post sql dialect using. assume sql92. cast
function first step: cast('20' || substring (exp_date,4,2) || '/' || substring (exp_date, 1,2) date)
. mssql uses '+
instead of ||
. after that, compare current_date - interval '1 month'
. caps here optional.
Comments
Post a Comment