Jump to content


Photo

calculating with date fields


  • Please log in to reply
1 reply to this topic

#1 Sharon Ann

Sharon Ann
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 26 April 2006 - 06:37 PM

Hi

I have a table called "fault". In this table I have fields called date_opened and date_closed.

I would like to select all records from "fault" whereby the time period between date_opened and date_closed is over 2 days. This is the pseudo code that I think I sort of need, but I'm not sure the correct way to write it in a php page.

Select * from fault where (date_closed - date_opened) >2;

Can anyone help?

#2 Sharon Ann

Sharon Ann
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 26 April 2006 - 07:05 PM

I've just found this bit of SQL and am wondering whether this is what I need,

select * from fault where Datediff('date_closed','date_opened')>2;

Is this the SQL or is there another way?






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users