List:General Discussion« Previous MessageNext Message »
From:Patrick Aljord Date:May 4 2008 3:00am
Subject:why does left join gives more results?
View as plain text  
hey all,

I have my query that counts posts per user:

SELECT count(*) as counted, c.user_id FROM posts c  group by c.user_id
having counted>1 order by counted DESC LIMIT 20

I wanted to add user login for each count so I did:

SELECT count(*) as counted, u.login FROM posts c left join users u on
posts.poster_id=u.id  group by c.user_id having counted>1 order by
counted DESC LIMIT 20

but now I get more results.

Any idea what I'm doing wrong?

Thanks in advance

Pat
Thread
why does left join gives more results?Patrick Aljord4 May 2008
  • Re: why does left join gives more results?Rob Wultsch4 May 2008
    • Re: why does left join gives more results?Patrick Aljord5 May 2008
      • Re: why does left join gives more results?Rob Wultsch5 May 2008
  • Re: why does left join gives more results?Brent Baisley5 May 2008