1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

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