I want to get student name details whose having student id and class id duplicate records through Multiple-Column Subquery.
Create Table TestNameList ( StudentId int, StudName varchar(50), ClassId int )
Insert into TestNameList values(1,'John',1)
Insert into TestNameList values(2,'John',2)
Insert into TestNameList values(1,'John',1)
Insert into TestNameList values(2,'John',3)
Insert into TestNameList values(3,'John',3)
Insert into TestNameList values(3,'Joshn',3)
select StudentId,StudName,ClassId from TestNameList
where (StudentId,ClassId) in (select studentid,ClassId from TestNameList group by studentid,ClassId having COUNT(*)>1)
For above code, error message is :
An expression of non-boolean type specified in a context where a condition is expected, near ','.
I think T-sql supports Multiple-Column Subquery,
does T-sql supports Multiple-Column Subquery ? then why this error is there ?
How can i get student name details Thorugh Multiple-Column Subquery ?
Please help me
Mark as Answer if its helpful to you
---
Srihari