SELECT c.customer_name, ROUND(SUM(i.total_price), 6)
FROM customer c
INNER JOIN invoice i ON c.id=i.customer_id
GROUP BY c.customer_name
HAVING SUM(i.total_price)<0.25*(SELECT AVG(total_price) FROM invoice)
ORDER BY ROUND(SUM(i.total_price), 6) DESC
This blog strives to provide answers to various problem statements in HackeRank.The blog is used only for educational purposes. This blog does not endorse copying answers.
No comments:
Post a Comment