Hi,

I want to select all records from a table where the DateAdded field's date and time (Default value Timestamp field) is more than say 3 hrs ago.

eg: something like

SELECT tbldata.* FROM tbldata WHERE (tbldata.DateAdded <= now()-3);

I can get it working with days difference but do not seem to be able to get the hours difference.

If anyone can guide me along the right lines it would be appreciated.

regards

Steve

Recommended Answers

All 2 Replies

SELECT tbldata.* FROM tbldata WHERE (tbldata.DateAdded <= DATE_SUB(now(), INTERVAL 3 HOUR));

Many thanks for the speedy reply.

Much appreciated.

Steve

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.