Q&A about the site for engineers, scientists, programmers, and computing professionals interested in quantum computing
declare @Start DATETIME = ##PostedAfter:string?2022-01-01##; declare @End DATETIME = ##PostedBefore:string?2023-01-01##; PRINT 'from ' + format(@Start, 'D') + ' to ' + format(@End, 'D'); WITH Questions AS ( SELECT top 2500 q.* FROM Posts q where q.posttypeid=1 --- questions and q.creationdate between @Start and @End --- asked in RANGE and q.score >= 0 --- positive score and q.answercount > 1 --- not just accepted answer order by NEWID() ) select q.id AS "Question Id", q.title AS "Question Title", q.body AS "Question Body", aa.body AS "Accepted Answer", aa.score AS "Accepted Score", a.body AS "Worst Answer", a.score AS "Worst Score" from Questions q inner join posts aa on q.acceptedanswerid = aa.id --- accepted answer inner join posts a on ( a.id = ( SELECT TOP 1 a.id --- lowest scoring answer FROM Posts a WHERE a.ParentId = q.Id ORDER BY a.score asc, a.id asc --- break ties deterministically by sorting id ) and a.score < aa.score --- strictly worse than aa ) where aa.score > 0 --- accepted answer has upvotes ;