This topic is locked
[SOLVED]

 another datediff question

5/20/2010 6:06:36 PM
PHPRunner General questions
swant author

i have to have another report similar to the following. I need to change it from 2 cell like it is and have one cell as today's date and use one of the existing columns. i cannot find anything helpful. any suggestions
SELECT

Name of Careset,

Build or Maintain,

Owner,

Date Build Requested,

Department Approval,

Compliance Approval,

Lab Approval,

Pharmacy Approval,

Quality Approval,

Radiology Approval,

Released to Prod,

DATEDIFF(**TODAYS DATE**, Date Build Requested) AS Days in Build Status

FROM List Of Needs

WHERE (Build or Maintain ="Build")

A
ann 5/21/2010

Hi,
use MySql function Now() to return the current date.

Here is a link:

http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_period-add

swant author 5/21/2010

I tried that before and this is what i have now and it gives me unknown column

DATEDIFF(Now(), Date Build Requested) AS Days in Build Status
i also tried DATEDIFF('Now()', Date Build Requested) AS Days in Build Status which doesn't return sql error but it returns null answer in my cell.

also tried with backticks, single quotes double quotes and no quotes and cannot get it to generate what i want
I had tried the now statement before but i cannot get my output correct. how do i need to place it in my statement?



Hi,
use MySql function Now() to return the current date.

Here is a link:

http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_period-add

A
ann 5/21/2010

Hi,
try

DATEDIFF(Now(), `Date Build Requested`)
swant author 5/21/2010

I figured it out it has to be like this

DATEDIFF (NOW(), Date Build Requested) AS Days in Build Status
NOW() has to be CAPS and nothing surrounding it



I tried that before and this is what i have now and it gives me unknown column

DATEDIFF(Now(), Date Build Requested) AS Days in Build Status
i also tried DATEDIFF('Now()', Date Build Requested) AS Days in Build Status which doesn't return sql error but it returns null answer in my cell.

also tried with backticks, single quotes double quotes and no quotes and cannot get it to generate what i want
I had tried the now statement before but i cannot get my output correct. how do i need to place it in my statement?

K
Kabukiblood 6/10/2010



I figured it out it has to be like this

DATEDIFF (NOW(), Date Build Requested) AS Days in Build Status
NOW() has to be CAPS and nothing surrounding it


Instead of using Now() use GetDate()