Can someone please take a look at the following query and let me know what I'm doing wrong. It supposed to show all tickets regardless if they have attachments are closed or open. The query works fine but it only brings the last two columns.
Code: Select all
SELECT t.id AS ID, t.tn AS 'Ticket No.', t.title AS Title, q.name AS Category, tt.name AS 'Incident', t.customer_id AS Customer, t.create_time AS 'In Call', a.change_time AS 'Closed In', aa.filename AS 'Service Order'
FROM article a LEFT JOIN article_attachment aa ON a.id = aa.article_id LEFT JOIN queue q ON a.id = q.id LEFT JOIN ticket t ON a.id = t.id AND q.id = t.queue_id LEFT JOIN ticket_state ts ON t.ticket_state_id = ts.id LEFT JOIN ticket_type tt ON t.type_id = tt.id