I've created some TracReports but trying to do them with SQL, I don't get the result I was expecting. This was my SQL query:
SELECT p.value AS __color__,
reporter AS __group__,
id AS ticket, summary, resolution , component,
t.type AS type, priority, severity, time AS created,
changetime AS modified,
changetime AS __changetime, description AS _description,
reporter AS _reporter
FROM ticket t
LEFT JOIN enum p ON p.name = t.priority AND p.type = 'priority'
WHERE t.status = 'closed'
ORDER BY changetime DESC, CAST(p.value AS integer), milestone, t.type, time
Using this query, the group by reporter doesn't worked at all. I get several rows per reporter. So I tried to get the result using the "Custom Query" function. That produced my expected result with the following TracQuery:
query:?status=closed
&group=reporter
&col=id
&col=summary
&col=resolution
&col=component
&col=type
&col=priority
&col=severity
&col=time
&col=changetime
&order=changetime
&desc=1
My question is: Can I convert TracQuery into the SQL statement or can I see the SQL statements that is done in the backend? I am asking because I want to be able to cast some of the columns or use other SQL functions.