select f.post_id , f.post_owner_user_id , f.post_title , ...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Woodworking

Q&A for professional and amateur woodworkers

select 
f.post_id
, f.post_owner_user_id
, f.post_title
, f.post_tags
, f.post_body
, f.post_accepted_answer_id
, f.comment_user_id
, f.comment_id
, f.comment_body
, f.comment_score
, f.answer_count
, case when f.comment_score/f.answer_count = score_total then 0
  else 1 end as multiple_answers

from 
  (select p.Id as post_id
  , p.OwnerUserid as post_owner_user_id
  , p.Title as post_title
  , p.tags as post_tags
  , p.body as post_body
  , p.AcceptedAnswerID as post_accepted_answer_id
  , c.owneruserid as comment_user_id
  , c.id as comment_id
  , c.body as comment_body
  , c.score as comment_score
  , count(cast(c.score as int)) OVER (PARTITION BY p.id, p.owneruserid
      , p.title, p.tags, p.body, p.acceptedanswerid) as answer_count
  , sum(cast(c.score as int)) OVER (PARTITION BY p.id, p.owneruserid
      , p.title, p.tags, p.body, p.acceptedanswerid) as score_total

  from Posts p

  join Posts c
      on p.id = c.parentid

  where
  p.tags like '%python-3.x%'
  and cast(c.score as int) > 1
  and cast(p.score as int) > 0
  and p.ownerdisplayname is null
  and c.ownerdisplayname is null
  
  group by p.id, p.owneruserid, p.title, p.tags, p.body, p.acceptedanswerid
  , c.owneruserid, c.id, c.body, c.score) f
  
where f.comment_score/f.answer_count != score_total

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results