sql server - SQL Select All Columns with grouped 2 columns have count = 1 -


i trying select 3 columns table based on first 2 columns (as group) having count = 1. once have been identified bring in 3rd column of row.

this statement works first 2 columns can't add 3rd column don't want search group defined this.

select   defect_point,   report_num mycount group defect_point,          report_num having count(*) = 1 

any ideas go here?

if understand right, use on clause , subquery achieve want.

select * ( select   defect_point, report_num, third_column,   count(*) over(partition defect_point, report_num) your_count mycount ) your_count = 1; 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -