# How to do nested queries? Data Science Foudation path - Analyze Hacker News Trend project

Hello,
I am working on the Analyze Hacker News Project https://www.codecademy.com/paths/data-science-foundations/tracks/dsf-learn-sql/modules/learn-sql-aggregate-functions-75448c0a-1e26-4b19-b967-c8aa75dff67a/projects/sql-hackernews and in task #3 we are asked to carry out a query regarding users with the biggests score of hacker_news and add them up. The guidelines are to carry out the query ( i will call this querry 1) using the GROUP BY user and filtering using the HAVING score > 200 clause. From this query a table with the results is derived.
The next task is to sum the score from the users with biggest score, and them divide it for the sum of the scores.
I found here an opportunity to go a little further and perform a nested query. So, if we use de query1 with the clause FROM, that´s what will get:

SELECT SUM(sum1) **
FROM(
** SELECT user, SUM(score) sum1

** FROM hacker_news **
** GROUP BY 1 **
** HAVING sum1 > 200);**

This query works perfect with the right outcome: Sum of the biggest score = 1412.

For the next task(#4) we have to add these users’ `score` s together and divide by the total to get the percentage. So, we need to divide the result of query1 by the total scores.
I would also like to use the feature of nested queries here . So, I used this another query query 2, but it doesn’t work as desired. The result is 0.

SELECT (SELECT SUM(sum1) **
FROM(
** SELECT user, SUM(score) sum1

** FROM hacker_news **
** GROUP BY 1 **
** HAVING sum1 > 200))/(SELECT SUM(score) FROM hacker_news) percentage;**

What am I doing wrong? The logic behind this query is basically: SELECT (query1)/(query2);
I thougt this would work, because it is pretty similar with the logic from the example: SELECT (1.0 + 2.0 + 3.0) / 6.0;
I just made the following substitutions: (1.0 + 2.0 + 3.0) => query1 and 6.0=> query2

Thank you for helping.