• claims.* , that is a pretty heavy table and only 5 columns are needed from it

    This may have the answer to your problem. The SELECT DISTINCT will work on all of the columns in the table, but you are only showing 5 of these to the end user. It is therefore possible that if two records from Claims differ only by the value in a non-displayed column, then the data displayed for the columns shown will be identical.

    The problem is not with the database, it is doing exactly what you asked it to do. The problem is with the query, you are not asking it to do what you want.

    Original author: https://github.com/SQL-FineBuild/Common/wiki/ 1-click install and best practice configuration of SQL Server 2019, 2017 2016, 2014, 2012, 2008 R2, 2008 and 2005.

    When I give food to the poor they call me a saint. When I ask why they are poor they call me a communist - Archbishop Hélder Câmara