jhanlon homework W6Q1

0

Please login or register to vote for this query.

(click on this box to dismiss)

Latin Language

Q&A for linguists, teachers, and students wanting to discuss the finer points of the Latin language

DECLARE @Start datetime ='2013-01-01';
DECLARE @End datetime ='2013-01-08';

SELECT 
  SUM(CASE WHEN (a.Score > 0 AND q.AcceptedAnswerId>0) THEN 1 ELSE 0 END) Accepted, 
                                  --^^Why not needed???
  COUNT(*) Total,
  SUM(CASE WHEN a.Score > 0 THEN 1 ELSE 0 END) * 100.0 / COUNT(*) Perc
  
FROM Posts q
LEFT JOIN Posts a ON q.AcceptedAnswerId = a.Id
WHERE q.ClosedDate BETWEEN @Start AND @END

Enter Parameters

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