Hi Dario, Could you clearly define what it is that you think is wrong? What are you expecting?
That said, I think there's a problem with your SQL -- your second and third SELECT statements use "current_date" rather than "@curday", which I suspect is what you really want to use :-) Cheers Kerry On Thu, Jun 10, 2010 at 11:34 AM, Dario Fassi <[email protected]> wrote: > hi, > I have found some curious results from DATEDIFF builtin function. > > As this: > > set @bird='1990-06-11'; > set @curday='2010-06-10'; > select datediff('YEAR',@bird,@curday) as y , > datediff('MONTH',@bird,@curday) as m , datediff('DAY',@bird,@curday) as > d, datediff('MONTH',@bird,@curday)/12 as yy ; > set @curday='2010-06-11'; > select datediff('YEAR',@bird,current_date) as y , > datediff('MONTH',@bird,current_date) as m , > datediff('DAY',@bird,current_date) as d, > datediff('MONTH',@bird,current_date)/12 as yy ; > set @curday='2010-06-12'; > select datediff('YEAR',@bird,current_date) as y , > datediff('MONTH',@bird,current_date) as m , > datediff('DAY',@bird,current_date) as d, > datediff('MONTH',@bird,current_date)/12 as yy ; > > Results; > > 20 240 7304 20 > 20 240 7303 20 > 20 240 7303 20 > > > I missed something or this is wrong? > > Regards, > Dario > > -- > You received this message because you are subscribed to the Google Groups > "H2 Database" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<h2-database%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/h2-database?hl=en. > > -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
