task 1


Please login or register to vote for this query.

(click on this box to dismiss)

Motor Vehicle Maintenance and Repair Meta

Q&A about the site for mechanics and DIY enthusiast owners of cars, trucks, and motorcycles

with ap as (select top 100000 AcceptedAnswerId as aId
     from Posts where PostTypeId = 1 and AcceptedAnswerId is not null),
  count_right as (select top 100000 OwnerUserId, COUNT(*) as quantity 
     from Posts as post inner join ap as ap on post.Id = ap.aId
where OwnerUserId is not null
group by OwnerUserId),
     total_quantity as(select top 100000 OwnerUserId, count(OwnerUserId) as total_quantity
from "Posts"
where PostTypeId = 2
group by OwnerUserId
having count(*) > 20),
t as (select top 100000 tq.OwnerUserId, total_quantity, quantity as right_quantity, 
(cast(quantity as float) / cast(total_quantity as float)) as result
from total_quantity as tq 
inner join count_right as cr on cr.OwnerUserId = tq.OwnerUserId)
select  * from t
where t.result = (select top 100000 max(result) from t)

Enter Parameters

Switch to main site
loading Hold tight while we fetch your results