I am trying to develop a query to insert unique records, but I am getting a SQL Server primary key error for trying to insert duplicate records. I managed to insert some values ββwith this query, but not for this record (score_14).
So now I am trying to find a duplicate entry with the following query. The challenge is that my PC is based on 3 columns: StudentID, MeasureDate and MeasureID - all from another table not mentioned below.
But it only shows me the score - instead, I just want to return the records with the score> 1. How do I do this?
select count(a.score_14) as score_count, A.studentid, A.measuredate, B.measurename+' ' +B.LabelName from [J5C_Measures_Sys] A join [J5C_ListBoxMeasures_Sys] B on A.MeasureID = B.MeasureID join sysobjects so on so.name = 'J5C_Measures_Sys' join syscolumns sc on so.id = sc.id join [J5C_MeasureNamesV2_Sys] v on v.Score_field_id = sc.name where so.type = 'u' and sc.name = 'score_14' and a.score_14 is not null AND A.STUDENTID IS NOT NULL AND A.MEASUREDATE IS NOT NULL AND B.MEASURENAME IS NOT NULL
source share