I want make a query to retrieve only those records from table which are unique on the basis of some coloumns

Recommended Answers

All 3 Replies

create table student9(roll int)
insert into student9 values(1)
insert into student9 values(1)
insert into student9 values(2)
insert into student9 values(3)
select distinct * from student9
create table student9(roll int)
insert into student9 values(1)
insert into student9 values(1)
insert into student9 values(2)
insert into student9 values(3)
select distinct * from student9

It is retrieval of unique records from table but I want retrieval of those records which are unique on some coloumns eg if table have 5 coloumns I want to retrieve only those records which are unique on 3 coloumns suppose a student table stores details of all college students I want to retrieve those records which are unique on name and address

It is retrieval of unique records from table but I want retrieval of those records which are unique on some coloumns eg if table have 5 coloumns I want to retrieve only those records which are unique on 3 coloumns suppose a student table stores details of all college students I want to retrieve those records which are unique on name and address

just replace the * with the column names...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.