[rt-users] Queries Sql

Ruslan Zakirov ruz at bestpractical.com
Tue May 31 14:21:30 EDT 2011


On Tue, May 31, 2011 at 10:02 PM, Felipe Agnelli Barbosa
<no.molas at gmail.com> wrote:
> How can I tell how many comments had every ticket via sql queries?

SELECT t.id AS id, txn.Type AS type, COUNT(txn.id) AS counter
FROM Tickets t
    LEFT JOIN Transactions txn
        ON txn.ObjectType = 'RT::Ticket'
        AND txn.ObjectId = t.id
        AND txn.Type IN ('Create', 'Comment', 'Correspond')
GROUP BY t.id, txn.Type;

> thanks in advance,
>
> Felipe
> BR
> --
> " A dúvida é o principio da sabedoria "

-- 
Best regards, Ruslan.



More information about the rt-users mailing list