我執行下面的查詢超過1行,並得到了錯誤「子查詢返回多個1行」子查詢返回在MySQL
我的查詢是
SELECT pkTicketID,
TicketReplyDateAdded,
TIMESTAMPDIFF(DAY, TicketReplyDateAdded, now()) as NumberOfDays
FROM tickets as T
LEFT JOIN ticket_replies as TR ON T.fkTicketReplyID=TR.pkTicketReplyID
WHERE 1 AND T.fkEmployeeID = '4'
AND (SELECT TIMESTAMPDIFF(DAY, TicketReplyDateAdded, now()) as NumberOfDays
FROM tickets as T
LEFT JOIN ticket_replies as TR
ON T.fkTicketReplyID=TR.pkTicketReplyID
) = 7
AND T.TicketStatus = 'Replied'
ORDER BY pkTicketReplyID DESC
感謝您的幫助。 歐麥爾