Have you tried this?

SELECT sid, count(*) FROM session
    LEFT JOIN ticket ON sid=reporter
    GROUP BY sid


On Aug 20, 9:48 am, Sumith <[EMAIL PROTECTED]> wrote:
> Dear Friends,
>
> I want to get the list of all users registered in Trac with the number
> of tickets belongs to each users.
>
> The user name should be displayed even though there is no ticket
> belongs to him/her.
>
> This is the query I try:
>
> SELECT
>    sid, count(*)
> FROM
>    session
> LEFT OUTER JOIN ticket
>    WHERE sid=reporter
>    GROUP BY sid
>
> However, this does not gives the user names without tickets.
>
> This was proven when I got 56 for:
> SELECT count(*) from (
>    SELECT
>       sid, count(*)
>    FROM
>       session
>    LEFT OUTER JOIN ticket
>       WHERE sid=reporter
>       GROUP BY sid)
>
> while I am getting 78 for:
> SELECT count(*) from sid.
>
> Where I do the mistake?
>
> Thanks in advance.
>
> Regards,
> Sumith


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To post to this group, send email to trac-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to