Jump to content


This topic is now archived and is closed to further replies.

Sharon Ann

calculating with date fields

Recommended Posts


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?

Share this post

Link to post
Share on other sites
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?

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.