Re: Trouble using SYSDATE()
Sean wrote:
> "Captain Paralytic" <paul_lautman@yahoo.com> wrote in message
> news:1167832817.316730.194960@s34g2000cwa.googlegr oups.com...
> >
> > Sean wrote:
> >
> >> I think that it would be better with
> >>
> >> SELECT * FROM mytable WHERE date > adddate(sysdate(), -60)
> >>
> >> Which is a spin off from "date_add(date, -60, DAY)"
> >>
> >> You can swap DAY for anything like:
> >>
> >> MICROSECOND
> >> SECOND
> >> MINUTE
> >> HOUR
> >> DAY
> >> WEEK
> >> MONTH
> >> QUARTER
> >> YEAR
> >>
> >>
> >> Hope that helps.
> >>
> > Why would it be better?
> > And why wouldn't you use subdate rather than adddate with a negative
> > argument?
> >
>
> Sorry, you're right.
>
> I was implying that this would be a better option than SYSDATE()-INTERVAL 60
> DAY and overlooked "sub_date", which of course makes even more sense.
>
> SA
But why is subdate (or date_sub) better than the opure maths approach
of
SYSDATE()-INTERVAL 60 ? |