WWereft51
WWereft51

Reputation: 11

data between two specific times in mysql get error

I am trying to select all data from my table where condition is

performDate will be between today 2.00 AM to tomorrow 2.00 AM

My query gives this error

 Incorrect parameter count in the call to native function 'DATEDIFF'

My query is

    SELECT * FROM `admin_marker` WHERE   
    FROM_UNIXTIME(performDate)
 BETWEEN DATEADD(DAY, DATEDIFF(DAY, 0, GETDATE()), 0) + '02:00'
                AND DATEADD(DAY, DATEDIFF(DAY, 0, GETDATE()+1), 0) + '02:00'

Upvotes: 0

Views: 215

Answers (2)

Thallius
Thallius

Reputation: 2619

Why dont you do it that way ?

WHERE performdate >=  DATE_FORMAT(NOW(), '%Y-%m-%d 02:00:00') AND performdate <=  DATE_FORMAT(CURRENTDATE + INTERVAL +1 DAY '%Y-%m-%d 02:00:00')

Upvotes: 0

Jens
Jens

Reputation: 69440

DATEDIFF expects only 2 parameters. You call it with 3 parameter.

Upvotes: 1

Related Questions