troubleshooting Question

Between MySQL datetime values?

Avatar of dolan2go
dolan2goFlag for United States of America asked on
MySQL Server
3 Comments1 Solution450 ViewsLast Modified:
runTime  is datetime type.

SELECT * FROM User WHERE runTime BETWEEN 2011-05-16 03:01:00 AND 2011-05-16 03:01:00

Open in new window


Results in:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '02:59:00 AND 2011-05-16 03:01:00' at line 1

SELECT * FROM User WHERE runTime BETWEEN '2011-05-16 03:01:00' AND '2011-05-16 03:01:00'

Open in new window


Results in:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros