Last active
January 2, 2016 15:58
-
-
Save alaiacano/8326572 to your computer and use it in GitHub Desktop.
`p(x|z,y,t)`, untested
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select numerator.x, numerator.num/denominator.denom, numerator.y, numerator.z, numerator.t | |
(select sum(x) as num, x, y, z, t from table group by x, y, z, t) numerator | |
join | |
(select sum(x) as denom, y, z, t from table group by y,z,t) denominator | |
on (numerator.y=denominator.y and numerator.z=denominator.z and numerator.t=denominator.t) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select numerator.x, numerator.num/denominator.denom | |
(select sum(x) as num, x from table where y=Y and z=Z and t=T group by x) numerator | |
cross join | |
(select sum(x) as denom from table where y=Y and z=Z and t=T) denominator |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment