•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 391,774 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,446 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MySQL advertiser:
Views: 1076 | Replies: 6 | Solved
![]() |
•
•
Join Date: May 2008
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 2
SELECT * FROM date BETWEEN '2008-10-01' AND '2008-12-12'
http://dev.mysql.com/doc/refman/5.0/...erator_between
Last edited by marrrrrrc : May 27th, 2008 at 8:33 am.
•
•
Join Date: Dec 2007
Posts: 107
Reputation:
Rep Power: 1
Solved Threads: 13
If the data type is datetime, then you must include time in the query
mysql Syntax (Toggle Plain Text)
SELECT * FROM table WHERE date_col BETWEEN '2008-10-01 00-00-00' AND '2008-12-12 23:59:59'
Last edited by mwasif : May 27th, 2008 at 2:31 pm.
•
•
Join Date: Jul 2008
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 1
I need help please with a similar issue but in my case I don't want a specific date.
I need to query all records created yesterday.
Since the get date function only finds records with the exact minute and second I need to use a range. Less than current date but greater than 23 hours 59 minutes old.
How can I write this query please?
THank you
Matthew
I need to query all records created yesterday.
Since the get date function only finds records with the exact minute and second I need to use a range. Less than current date but greater than 23 hours 59 minutes old.
How can I write this query please?
THank you
Matthew
•
•
•
•
If the data type is datetime, then you must include time in the query
mysql Syntax (Toggle Plain Text)
SELECT * FROM table WHERE date_col BETWEEN '2008-10-01 00-00-00' AND '2008-12-12 23:59:59'
•
•
Join Date: Jul 2008
Location: Hyderabad,India.
Posts: 522
Reputation:
Rep Power: 2
Solved Threads: 53
mysql Syntax (Toggle Plain Text)
SELECT * FROM table WHERE date_col<curdate() AND date>DATE_ADD(CURDATE(), INTERVAL -1 DAY)
Last edited by Shanti Chepuru : 30 Days Ago at 2:43 am. Reason: add code tags
Champions Are Not SuperNatural,They Just Fought For One More Second When Every One Else Quit...Some times That One Second Of Effort Gives You The VICTORY...
•
•
Join Date: Jul 2008
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 1
Thank you very much for your help.
I was able to solve it in fact with datediff(date_col,getdate()) = -1
We are running mssql
Best regards,
Matthew
I was able to solve it in fact with datediff(date_col,getdate()) = -1
We are running mssql
Best regards,
Matthew
•
•
•
•
mysql Syntax (Toggle Plain Text)
SELECT * FROM table WHERE date_col<curdate() AND date>DATE_ADD(CURDATE(), INTERVAL -1 DAY)
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb MySQL Marketplace
Similar Threads
- Retrieving duplicate consecutive records.(How to make query for this scenario?) (MS SQL)
- sending a datetime to database (JSP)
- Hard to Query (MS SQL)
- DATETIME data type arithmenic in SQL Server 2005 (MS SQL)
- query for creating report group by weeks (with start date and end date of the week) (MS SQL)
- Sql Query Help (MySQL)
- C# VS 2005 - SQL Query Parameters to an ODBC DataSource (C#)
- datetime format (MS SQL)
- need urgent help for a query (MS SQL)
Other Threads in the MySQL Forum
- Previous Thread: update database entries
- Next Thread: Which command to use?


Linear Mode