Link to home
Start Free TrialLog in
Avatar of dolan2go
dolan2goFlag for United States of America

asked on

Between MySQL datetime values?

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
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dolan2go

ASKER

Wow. That was easy for you.

Solution:
Cut n paste is not always a time saver.
A great answer to get right to the point.
Thanks.