Hey, Stogarepih.
It seems you may benefit from learning more about SQL before you continue. It will be better than posting to a forum to get others to write your code for you.
But, in an effort to help you in your immediate situation...
Your SQL above has a couple of problems. 1) you cannot have a separate label for your summatino item. Instead of,
select sum(statistics.passed_on) as sum 1
you should have,
select sum(statistics.passed_on) as sum_1
SQL will read the "sum 1" with the space as separate items and throw an error.
When you do aggregate processes in a SQL statement, you need to make sure all your returned items are in some form of aggregation. If not in the "select" part, then you need to add them in a "group by" clause at the end, or some other type of aggregation method.
To summarize, a correct example of your statement above may be something like,
select sum(statistics.passed_on) as sum_1, hospitals
from
group by hospitals
Since you are aggregating the "statistics.passed_on" item, you need to aggregate every other column you are selecting in the statement.
-joe j.