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?
>
> - John
Hi John
Just look at: "7.3.11 Date and time functions "
in the mysql manual.
Tschau
Christian