Q1

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

/*WITH Min_Q2 AS (
SELECT TOP 50000 ViewCount
FROM Posts
WHERE ViewCount >= 10000
ORDER BY ViewCount DESC 
) 
SELECT MIN(ViewCount) AS MinCount INTO #Temp FROM Min_Q2

SELECT TOP 50000 Id,PostTypeId,Score,ViewCount,Body,OwnerUserId,OwnerDisplayName,Title,Tags
FROM Posts
WHERE ViewCount < (Select * from #Temp)
ORDER BY ViewCount DESC 
*/
/*
SELECT TOP 50000 Id,PostTypeId,Score,ViewCount,Body,OwnerUserId,OwnerDisplayName,Title,Tags
FROM Posts
WHERE ViewCount < (SELECT MIN(ViewCount) 
                   FROM (SELECT TOP 50000 ViewCount
                         FROM Posts 
                         WHERE ViewCount >= 10000 
                         ORDER BY ViewCount DESC) A
                  )
ORDER BY ViewCount DESC 
*/

/*
DECLARE @TempVar int
SET @TempVar = (SELECT MIN(ViewCount) 
                FROM (SELECT TOP 150000 ViewCount
                      FROM Posts 
                      WHERE ViewCount >= 10000 
                      ORDER BY ViewCount DESC) A
               )
PRINT @TempVar

*/
SELECT TOP 50000 Id,PostTypeId,Score,ViewCount,Body,OwnerUserId,OwnerDisplayName,Title,Tags
FROM Posts
WHERE ViewCount < 53347 
ORDER BY ViewCount DESC

Enter Parameters

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