Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > MySQL
| Search | Today's Posts | Mark Forums Read
MySQL General discussion about the MySQL database.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the MySQL section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 26th, 2012, 12:28 AM
Authorized User
Points: 64, Level: 1
Points: 64, Level: 1 Points: 64, Level: 1 Points: 64, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2012
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default QUERY TO extract data from database

ok i have data stored in my database field is datetime/timestamp.
so what i want is, i want data to be displayed which is older than 24 hours only.

SO how could i write query for that??
  #2 (permalink)  
Old September 19th, 2012, 05:30 AM
Registered User
 
Join Date: Sep 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the info you can find your answers here.. Php and Mysql with basic javascripts.
http://www.wiziq.com/course/5871-php...egrated-course
  #3 (permalink)  
Old October 25th, 2012, 05:05 PM
Friend of Wrox
Points: 1,515, Level: 15
Points: 1,515, Level: 15 Points: 1,515, Level: 15 Points: 1,515, Level: 15
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2003
Location: Oxford, , United Kingdom.
Posts: 488
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Quote:
Originally Posted by internetpirate11 View Post
ok i have data stored in my database field is datetime/timestamp.
so what i want is, i want data to be displayed which is older than 24 hours only.

SO how could i write query for that??
Code:
SELECT * FROM table WHERE datetime <(UNIX_TIMESTAMP(NOW()) - 24*60*60);
A UNIX timestamp is a count of seconds since 1 Jan 1970 24*60*60 is the number of seconds in 24 hours.

You can also write (IIRC):

Code:
WHERE datediff(hh, datetime, NOW()) < 24
__________________
--
Charlie Harvey's website - linux, perl, java, anarchism and punk rock: http://charlieharvey.org.uk
  #4 (permalink)  
Old November 21st, 2012, 04:15 AM
Authorized User
Points: 64, Level: 1
Points: 64, Level: 1 Points: 64, Level: 1 Points: 64, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2012
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thank you....................


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extract Query from OLEDB Datasource lavisualstudio BOOK: Professional Microsoft SQL Server 2008 Integration Services ISBN: 978-0-470-24795-2 0 August 4th, 2010 10:19 PM
Query to extract data from 2 tables of .mdb file Subuana Beginning VB 6 6 March 16th, 2006 04:37 PM
Extract Excel data to Access Database sriramus Access VBA 1 February 28th, 2006 01:52 PM
Extract build data from Oracle database chandra1977 Oracle 1 March 11th, 2004 02:22 PM
A query to extract part of a string RayL Access 3 March 10th, 2004 09:42 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.