Random Unanswered Posts

0

Please login or register to vote for this query.

(click on this box to dismiss)

Physics

Q&A for active researchers, academics and students of physics

-- Version 1

SELECT TOP 15
 'TRUE' AS 'Cached',
  po.Score,
  po.Id AS [Post Link],
  po.ViewCount AS Views,
  po.Tags
FROM
  Posts po
WHERE
  -- PostTypeId of 1 is a question
  po.PostTypeId = 1 
  
  -- We want unanswered questions, right?
  AND po.AnswerCount = 0 
  
  -- Let's go for some tumbleweeds too (less likely to be closed)
  AND po.ViewCount < 50 
  
  -- make Id be more than a certain amount, 
  -- in this case a random point in the posts list
  -- Note that because we order by 'Id',
  -- the posts returned will all be sequential.
  AND po.Id > RAND() * 
      (SELECT TOP 1 
          Id 
        FROM Posts 
        ORDER BY Id DESC) 
   
  -- Closed questions are of no use to us --      
  AND po.ClosedDate IS NULL
ORDER BY Id

Enter Parameters

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