SadmanSakib93 / HackerRank-SQL-Intermediate-Certificate

5 stars 9 forks source link

Customer spending Sql error #3

Open RijoKsd opened 1 year ago

RijoKsd commented 1 year ago

The customer spending question answer of hacker rank is wrong the correct answer is SELECT c.customer_name, CAST(SUM(i.total_price) AS DECIMAL(9,6)) AS total 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 total DESC;

Malkhedkar commented 1 month ago

its working