Percentage Closed as too broad

0

Please login or register to vote for this query.

(click on this box to dismiss)

Android Enthusiasts

Q&A for enthusiasts and power users of the Android operating system

SET NOCOUNT OFF;

DECLARE @MinID INT;
SET @MinID = 37200000

DECLARE @QueryString nvarchar (max)
set @QueryString = '%-1%'

DECLARE @Total INT;
--SELECT 
SELECT @Total = COUNT(*) FROM Posts p WHERE p.PostTypeId = 1 AND p.Id > @MinID AND LOWER(p.Body) like @QueryString

DECLARE @ClosedAll INT
SELECT @ClosedAll = COUNT(*) FROM Posts p WHERE p.PostTypeId = 1 AND p.Id > @MinID AND p.ClosedDate is not null AND LOWER(p.Body) like @QueryString

SET NOCOUNT ON;
Select 
  @Total AS [Total questions containing phrase], 
  @ClosedAll AS [Closed questions containing phrase],
  100 * (@ClosedAll * 1.0 / @Total * 1.0) AS [Percentage Closed];
  
select * FROM Posts p 
  WHERE p.PostTypeId = 1 
  AND p.Id > @MinID 
  AND LOWER(p.Body) like @QueryString

Enter Parameters

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