mysql的错误如下。
1064-您的SQL语法有误;查看与您的MySQL服务器版本相对应的手册以使用正确的语法
在'message.msg_type = R GROUP BY票证附近。ticket_id订购者
ticket.created DESC LIMIT'在第1行
查询如下。
SELECT DISTINCT
ticket.ticket_id,lock_id,ticketID,ticket.dept_id,ticket.staff_id,subject,ticket.name,ticket.email,dept_name,lastresponse
,ticket.status,ticket.source,message.message,isoverdue,isanswered,ticket.created,pri.*
,count(attach.attach_id) as attachments
,staff.firstname,staff.lastname , IF(ticket.reopened is
NULL,ticket.created,ticket.reopened) as effective_date FROM
kt_ticket ticket LEFT JOIN kt_department dept ON ticket.dept_id =
dept.dept_id LEFT JOIN kt_priority pri ON
ticket.priority_id=pri.priority_id LEFT JOIN kt_ticket_lock tlock ON
ticket.ticket_id=tlock.ticket_id AND tlock.expire>NOW() LEFT JOIN
kt_ticket_attachment attach ON ticket.ticket_id=attach.ticket_id
LEFT JOIN kt_ticket_message message ON
(ticket.ticket_id=message.ticket_id ) LEFT JOIN kt_staff staff ON
ticket.staff_id=staff.staff_id WHERE 1=1 AND status='open' AND
ticket.pp_group =1 message.msg_type=R GROUP BY ticket.ticket_id
ORDER BY ticket.created DESC LIMIT 0,25
最佳答案
在以下两个条件之间缺少AND
子句。
ticket.pp_group =1
和
message.msg_type=R
在比较
R
时,chracter
也应用单引号引起来。这样看起来像这样,
AND ticket.pp_group =1 AND message.msg_type='R'
关于php - 1064-您的SQL语法有误;查看与您的MySQL服务器版本相对应的手册以使用正确的语法,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/39362997/