Queries Sql

How can I tell how many comments had every ticket via sql queries?

thanks in advance,

Felipe
BR
" A dúvida é o principio da sabedoria "

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.