Here is my query:
UPDATE reputations SET 
    type = new.type,
    score = new.score,
    qora = NOT (new.post_id = (SELECT t1.id
        FROM qanda t1 
        WHERE (EXISTS (SELECT 1 
            FROM qanda t2 
            WHERE ID = new.post_id 
                AND t1.ID = t2.related)
                OR t1.id = new.post_id)
                AND Type = 0)),
    question_id = (SELECT t1.id
        FROM qanda t1 
        WHERE (EXISTS (SELECT 1 
            FROM qanda t2 
            WHERE ID = new.post_id 
                AND t1.ID = t2.related)
                OR t1.id = new.post_id)
                AND Type = 0),
    post_id = new.post_id,
    table_code = new.table_code,
    comment_id = new.comment_id,
    owner_id = new.author_id,
    date_time = UNIX_TIMESTAMP()
WHERE events_table_id = old.id;
All I'm trying to do is remove one of those sub-queries, since both are identical. How can I do that?
 
     
    