Sample Header Ad - 728x90

Using DISTINCT in window function with OVER

25 votes
5 answers
80780 views
I'm trying to migrate a query from Oracle to SQL Server 2014. Here is my query which works great in Oracle: select count(distinct A) over (partition by B) / count(*) over() as A_B from MyTable Here is the error i got after tried to run this query in SQL Server 2014. Use of DISTINCT is not allowed with the OVER clause Anyone know what is the problem? Is such as kind of query possible in SQL Server? Please advise.
Asked by Omri (383 rep)
Jan 11, 2015, 09:21 AM
Last activity: Nov 20, 2024, 07:34 AM