?
Solved

Select by date

Posted on 2011-10-11
9
Medium Priority
?
330 Views
Last Modified: 2012-05-12
I need to do a select in mysql where [calldate] = today
0
Comment
Question by:lrbrister
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 12

Accepted Solution

by:
jet-black earned 2000 total points
ID: 36952211
You can use this query:
SELECT
*
FROM [i]your_table[/i]
WHERE
DATE(calldate) = DATE(NOW())

Open in new window


Also, look manual for other date functions:
http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html
0
 
LVL 8

Expert Comment

by:PranjalShah
ID: 36952226
select * from table where date=CURDATE()
0
 
LVL 8

Expert Comment

by:PranjalShah
ID: 36952233
oops..missed the date call

select * from table where date(calldate)=CURDATE()
0
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 
LVL 12

Expert Comment

by:jet-black
ID: 36952248
Yeah, PranjalShah's suggestion (using CURDATE()) is faster.
0
 
LVL 3

Expert Comment

by:boraganesh
ID: 36953684
yes select * from table where date(calldate)=CURDATE()  is the exact solution..if required you can add index on calldate so it will be more fastest
0
 

Author Closing Comment

by:lrbrister
ID: 36955252
Thanks
0
 

Author Comment

by:lrbrister
ID: 36955288
PranjalShah:
Sorry...I generally grab the first answer from someone and if it works accept it.  The real answer would hav ebeen a split maybe.  I'll test closer next time.
0
 
LVL 12

Expert Comment

by:jet-black
ID: 36955484
@lrbrister
You're welcome.

@PranjalShah
If you want, you can request splitting points.
0
 
LVL 8

Expert Comment

by:PranjalShah
ID: 36957254
Not for the sake of points but other people searching on IE for this kind of solution can look at both the solutions...I will leave this to author
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating and Managing Databases with phpMyAdmin in cPanel.
This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month16 days, 19 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question