date in variables comparison issue

Discussion in 'MySQL' started by lektrikpuke, Dec 7, 2013.

  1. #1
    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?

    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;
    Code (markup):
     
    lektrikpuke, Dec 7, 2013 IP
  2. lektrikpuke

    lektrikpuke Well-Known Member

    Messages:
    297
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    113
    #2
    Never mind, just didn't have data in the date range. Duh.
     
    lektrikpuke, Dec 16, 2013 IP