I was wondering if I had any data like
score name A 2 B 5 C 7
I would like to have a 3rd row
name total score A 2 14 B 5 14 C 7 14
I mean finally – I want to find z scores & # 39; or input percentiles of varied rows on different totals. I do not know if there is a simple way to compare row values with aggregated values except by a subquery such as
select A.name, A.score, B.total myTable A left joint (select the name, sum (score) of the myTable group by name) B on A.name = B.name
This might work, but it seems inefficient to query the same table twice for a calculation. Is there a simpler way to do it that I miss?