Hi,
OK... now that you showed us what you did, it is simple to explain the issue :-)
The confusing is related to the way GROUP BY behaves in Dedicated SQL Pool.
GROUP BY Is not fully supported and when you use simple GROUP BY on a unique constraint then the server do not aggregate the data. The number of rows in the result SET will be the same as the number of rows you inserted and the value of the function COUNT(*)
will be 1.
Therefore, when you added the filter HAVING COUNT(*)>1
then no row retuned.
The following document presents a simple example. Notice that before adding the unique constrain the GROPUP BY works and returns only 4 rows but after adding the constraint it simply do nothing.
It is well documented that GROUP BY in Dedicated SQL Pool is only fully supported when using one of the three types of grouping: GROUP BY with ROLLUP, GROUPING SETS or GROUP BY with CUBE
The solution in your case is to use a query like bellow (for example using ROLLUP)
SELECT a1, count(*) AS total FROM t2 GROUP BY ROLLUP (a1) HAVING not a1 is null
----------
Ronen Ariely
Personal Site | Blog | Facebook | Linkedin