Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"
ORDER NOW

My homework is based on sql tables i created revolving around a vehicle

My homework is based on sql tables i created revolving around a vehicle

sales database. It requires i build a SELECT query to display the institution and loan type of the financing plan that was used for the most sales. I have found other solutions online (which i have pasted below), and while it makes sense in my head, It keeps displaying all the institutions and loan types. I cannot get the Rank to work correctly to only show the top results. I need help with the correct format of Rank or some help on what i am doing wrong. Thanks

select institution, loan_type
from financing_plans
where plan_id=(select financing_plans.plan_id
from(select sales_financings.plan_id,
Count(*) as plan_count,
Rank () over (order by count (*) desc)
as Rank
from sales
inner join SALES_FINANCINGS
on sales.sale_id = sales_financings.sale_id
group by sales_financings.plan_id)
where rank=1);

 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"