i am trying to run this SQL Query:
SELECT avg(response_seconds) as s FROM
( select time_to_sec( timediff( from_unixtime( floor( UNIX_TIMESTAMP(u.datetime)/60 )*60 ), u.datetime) ) ) as response_seconds
FROM tickets t JOIN ticket_updates u ON t.ticketnumber = u.ticketnumber
WHERE u.type = 'update' and t.customer = 'Y' and DATE(u.datetime) = '2016-04-18'
GROUP BY t.ticketnumber)
AS r
but i am seeing this 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 'FROM tickets t JOIN ticket_updates u ON t.ticketnumber = u.ticketnumber WHE' at line 3
and i cannot work out where the error is in the query
Remove the ) just before as response_seconds
SELECT avg(response_seconds) as s FROM
( select time_to_sec( timediff( from_unixtime( floor( UNIX_TIMESTAMP(u.datetime)/60 )*60 ), u.datetime) ) as response_seconds
FROM tickets t
JOIN ticket_updates u ON t.ticketnumber = u.ticketnumber
WHERE u.type = 'update'
and t.customer = 'Y'
and DATE(u.datetime) = '2016-04-18'
GROUP BY t.ticketnumber
) AS r
You had to many closing brackets on that calculation which had the effect of closing the sub select to early.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With