Пожалуйста, мне нужно иметь уникальные строки, основанные на некоторых определенных столбцах в моей таблице.
Это моя таблица ниже
CREATE TABLE [dbo].[tbl_StudentProgress]
(
[ID] [int] IDENTITY(1,1) NOT NULL,
[FK_ClassId] [int] NOT NULL,
[StudentName] [nvarchar](max) NULL,
[AdmissionNumber] [nvarchar](max) NULL,
[Term] [nvarchar](max) NULL,
[Fk_SubjectId] [int] NOT NULL,
[Assignment1] [decimal](18, 2) NOT NULL,
[Assignment2] [decimal](18, 2) NOT NULL,
[Assignment3] [decimal](18, 2) NOT NULL,
[Note] [decimal](18, 2) NOT NULL,
[CA1] [decimal](18, 2) NOT NULL,
[CA2] [decimal](18, 2) NOT NULL,
[Exam] [decimal](18, 2) NOT NULL,
[TotalScore] [decimal](18, 2) NOT NULL,
[ClassName] [nvarchar](max) NULL,
[UserName] [nvarchar](max) NULL,
[FK_Session] [int] NOT NULL,
[DateEntered] [datetime] NOT NULL DEFAULT ('1900-01-01T00:00:00.000'),
CONSTRAINT [PK_dbo.tbl_StudentProgress]
PRIMARY KEY CLUSTERED ([ID] ASC)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF,
IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON,
ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
Конкретные столбцы: FK_ClassId
, StudentName
, AdmissionNumber
, Term
, FK_SubjectId
и FK_Session
.
Пожалуйста, как мне это сделать?
Спасибо, Тим