That select (count(*) from Table_X tx where tx.blah = 0.75
will return a single value y and 0.5 * y will be a single value.. Where does sum come into it. It is normally applied to GROUP BY statements. Can you provide the original SQL if you have (Oracle, Sybase whatever)? HTH Dr Mich Talebzadeh LinkedIn * https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw <https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw>* http://talebzadehmich.wordpress.com On 12 March 2016 at 21:25, ws <wlodek_sie...@yahoo.com> wrote: > I need to re-write something like this to Hive: > > ### > select x.A, > sum(0.5 * (select (count(*) from Table_X tx where tx.blah = 0.75))) > from Table_X x > ### > > Thanks in advance for any pointer to it. >