At 2:47 PM -0400 8/2/99, Silicon Ghost wrote:
>I am trying to do the following SELECT statement, but I need the answer
>returned to be a single digit number. If I do this in an Excel formula for
>example, the answer for the statement below is 2, which is what I want.
>
>(the CURRENT_DATE is 1999-08-02)
>
>mysql> SELECT ROUND(((CURRENT_DATE-"1999-07-19")/7),0);
>+------------------------------------------+
>| ROUND(((CURRENT_DATE-"1999-07-19")/7),0) |
>+------------------------------------------+
>| 2855543 |
>+------------------------------------------+
>
>Also, I tried entering the exact same thing as above, but I manually entered
>today's date. This gave me 0 as an answer. I don't quite understand that
>either. See my example below:
>
>mysql> SELECT ROUND((("1999-08-02"-"1999-07-19")/7),0);
>+------------------------------------------+
>| ROUND((("1999-08-02"-"1999-07-19")/7),0) |
>+------------------------------------------+
>| 0 |
>+------------------------------------------+
>
>Any suggestions?
You might find the TO_DAYS() function useful for converting dates to days.
Then you can do your math.
--
Paul DuBois, paul@*stripped*