Hi Jed,
Though this works,when I tried to insert an inner query in that,it is
giving an error in syntax.Can u please help me in thi matter?I gave the
query as follows:
select TO_DAYS(CURDATE()) - TO_DAYS(select dates from userregistration
where userid like 'abhilas');
Abhilash
> Hello, Abhilash,
>
> If you just want the number of days between two dates, you don't need
> FROM_DAYS. FROM_DAYS gives you a date. This should be all you need:
>
> Select TO_DAYS(CURDATE()) - TO_DAYS('2001-08-30');
>
> HTH,
> Jed
>
> On the threshold of genius, [EMAIL PROTECTED] wrote:
>
> > Hi,
> > My intention is to get the datedifference(in no of days) between
> > the
> > current date and a previously entered date which is in a table(of
> > course
> > this date is lower in value than the current date).When I used this
> > query:
> > select FROM_DAYS(TO_DAYS(CURDATE()) - TO_DAYS('2001-08-30'));
> >
> > Here the problem comes is that it is checks first the year,then the
> > month
> > and then the days;and if anywhere it finds that the difference is a
> > negative
> > value,it prints as follows:
> > -----------------------------------------------------+
> > FROM_DAYS(TO_DAYS(CURDATE()) - TO_DAYS('2001-08-30'))
> > -----------------------------------------------------+
> > 0000-00-00 |
> > -----------------------------------------------------+
> > So how can I rectify this problem?
> > Abhilash
> >
> >
> >
> > ---------------------------------------------
> > This message was sent using Endymion MailMan.
> > http://www.endymion.com/products/mailman/
> >
> >
> >
> > ---------------------------------------------------------------------
> > Before posting, please check:
> > http://www.mysql.com/manual.php (the manual)
> > http://lists.mysql.com/ (the list archive)
> >
> > To request this thread, e-mail <[EMAIL PROTECTED]>
> > To unsubscribe, e-mail <mysql-unsubscribe-
[EMAIL PROTECTED]>
> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> >
> >
---------------------------------------------
This message was sent using Endymion MailMan.
http://www.endymion.com/products/mailman/
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php