How many days out...

2002-10-01 Thread Chuck Payne

Hi,

I am having problems get how many days out an invoice is from mysql. I have
try this.

SELECT NOW()-summitted_date FROM table;

But it not working as usually. So please guys a little help.

So If an invoice was summitted on 9-26-02 then I should be able to see that
5 days.

Chuck Payne
Magi Design and Support
sql, mysql



-
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




Re: How many days out...

2002-10-01 Thread Paul DuBois

At 15:41 -0400 10/1/02, Chuck Payne wrote:
Hi,

I am having problems get how many days out an invoice is from mysql. I have
try this.

SELECT NOW()-summitted_date FROM table;

But it not working as usually. So please guys a little help.

What do you mean not working as usually?  A query written like that
will *never* work.  That's not how you do date arithmetic in MySQL.
(That is, MySQL will calculate an answer, but it's not going to be what you
seem to expect.)

Try TO_DAYS(NOW()) - TO_DAYS(summitted_date) to get the difference between
dates in days.


So If an invoice was summitted on 9-26-02 then I should be able to see that
5 days.

Chuck Payne
Magi Design and Support
sql, mysql


-
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