select users.id, users.displayname from users, posts wher...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

select users.id, users.displayname
  from users, posts
  where users.id = posts.owneruserid and users.location = 'Russia'
  group by users.id, users.displayname
  having
    count(case when posts.posttypeid = 2 then 1 else null end) > 0
    and count(case when posts.posttypeid = 1 then 1 else null end) = 0 or
    count(case when posts.posttypeid = 1 then 1 else null end) > 0
    and count(case when posts.posttypeid = 2 then 1 else null end) = 0
  order by users.id

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results