-2

I thought that the following would be the way I search for all calls placed in a 10 minute time frame

SELECT * FROM `call_log` WHERE start_time BETWEEN ('2012-05-01 17:50:00' AND '2013-05-01 18:00:00')

However when I run this query I get the following error

#1064 - 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 'LIMIT 0, 30' at line 2

I am not sure what this currently means. The date formate is the same as above too.y-m-d h:m:s

halfer
  • 19,824
  • 17
  • 99
  • 186
RussellHarrower
  • 6,470
  • 21
  • 102
  • 204

2 Answers2

1

You don't need the parentheses:

SELECT * FROM `call_log` 
WHERE 
start_time BETWEEN '2012-05-01 17:50:00' AND '2013-05-01 18:00:00'
chue x
  • 18,573
  • 7
  • 56
  • 70
  • 2
    And, more specifically, using them causes MySQL to parse the contents of the parentheses as the first `BETWEEN` operand, so it complains that the second one is absent when it encounters the `LIMIT` clause. – eggyal May 06 '13 at 01:22
0

Below is the MySQL link around these type of queries and functions. As someone noted (and beat me to it), you do not need the parentheses...

http://dev.mysql.com/doc/refman/4.1/en/date-and-time-functions.html