Select All Field (if field not exist, make field with null value)
Your issue is you're using an INNER JOIN (JOIN for short) between the same ticket_id of your cc_queue_detail table a1, and two different sets of rows from your second and third instance of the cc_queue_detail table, a2 and a3. This basically is saying the ticket_id has to match between a1, a2, and a3 always, but because of your WHERE clause, that's not possible, since a2 and a3 are different sets of rows from your cc_queue_detail table.
You'll want to use an OUTER JOIN, such as a LEFT OUTER JOIN (LEFT JOIN for short) to accomplish your goal, something like this:
SELECT DISTINCT
    a1.ticket_id AS 'ticket_id',
    a2.data_content AS 'category_ticket_1',
    a3.data_content AS 'category_ticket_2'
FROM cc_queue_detail a1
LEFT JOIN cc_queue_detail a2 
    ON a1.ticket_id = a2.ticket_id
    AND a2.field_name_id = &quot;category_ticket_1&quot;
LEFT JOIN cc_queue_detail a3 
    ON a1.ticket_id = a3.ticket_id
    AND a3.field_name_id = &quot;category_ticket_2&quot;

Now you'll get all rows back from a1, your entire cc_queue_detail table, and where there isn't a match between the other instances of the table (a2 and a3) there will be NULL values.