{11} Същия като {10}, но с подреждане по последните две колони

Report execution failed:
OperationalError: near "?": syntax error

SELECT COUNT(*) FROM (
SELECT  p.value AS __color__,
        t.id AS ticket, t.summary AS summary, t.component AS component,  
        (CASE t.status WHEN 'assigned' THEN t.owner||' *' ELSE t.owner END) AS owner,
        t.time AS created,
        t.changetime AS _changetime, t.description AS _description,
        t.reporter AS _reporter, cc.comment_count AS count,
        lc.last_comment AS modified
FROM    ticket t, enum p,
        (SELECT   t.id, count (tc.ticket) AS comment_count
         FROM     ticket t, ticket_change tc
         WHERE    tc.field='comment' 
                  AND t.id=tc.ticket 
         GROUP BY t.id) cc,
        (SELECT   tt.id, max(tce.time) AS last_comment
         FROM     ticket tt, ticket_change tce 
         WHERE    tt.id=tce.ticket 
                  AND tce.field='comment'
         GROUP BY tt.id) lc


WHERE    t.status <> 'closed' 
         AND p.name = t.priority AND p.type = 'priority'
         AND t.id=cc.id
         AND t.id=lc.id
ORDER BY %s %s
) AS tab
Note: See TracReports for help on using and creating reports.