We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • HackerRank Home

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • Apply
  • Hiring developers?
  1. Prepare
  2. SQL
  3. Basic Join
  4. Ollivander's Inventory
  5. Discussions

Ollivander's Inventory

Problem
Submissions
Leaderboard
Discussions

    You are viewing a single comment's thread. Return to all comments →

  • Mohak_mj
    3 months ago+ 0 comments

    With Cte as (select WP.age as Cte_Age, min(W.coins_needed) as Cte_Coins,W.power as Cte_Power from Wands W left join Wands_Property WP on W.code = WP.code where WP.is_evil = 0 group by WP.age, W.power ) select max(A.id) ,Cte_Age,Cte_Coins,Cte_Power from Cte inner join Wands A on A.coins_needed = Cte_Coins and A.power = Cte_Power inner join Wands_Property B on B.Age = Cte_Age where B.is_evil = 0 group by Cte_age,Cte_Coins, Cte_Power order by Cte_Power desc, Cte_Age desc

    0|
    Permalink
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy