I have a query in mysql
select f1,f2,f3 from tableName;
I want to remove duplicate value in field f1 and f2 only,
I have tired as follows
select f1,f2,f3 from tableName
group by f1,f2;
But it will remove duplicates in f1 only.Any body can suggest me that how to remove duplicates in f1 and f2.
topic_id topic_name question_type
2237 Understanding Diversity Comprehensive
2237 Understanding Diversity Easy
2237 Understanding Diversity Application
44315 Bhasha, boli, lipi, or Vayakaran Intermediate
above is sample output having distinct value in question_type column only
here i want to remove duplicates from question_type and topic_id
expected output: having both topic_id and question_type distinct values
44315 Bhasha, boli, lipi, or Vayakaran Intermediate
2237 Understanding Diversity Comprehensive
My SQL really isn’t that great, but I think you need to do what is called a nested SELECT statement.
Here is the manual reference.
http://dev.mysql.com/doc/refman/5.0/en/subqueries.html
That would make the SQL look something like this.
Note, that I had to use the AS to create an alias, else “tableName” would conflict with the parent SQL select.