date in variables comparison issue
Not quite sure why this is not working. If I comment out one of the comparison it works fine. Just doesn't work when both dates are compared at the same time. Is this a variable issue? Any ideas?
Code (text):
set @vfutureDate = (select date_add(curdate(), interval 30 day));
set @vmonth = extract(month from @vfutureDate);
set @vday = extract(day from @vfutureDate);
select * from tbl
where
monthDt = @vmonth
and
dayDt <= @vday;
See original post by lektrikpuke
Leave a Reply
You must be logged in to post a comment.