Select a separate field along other queries while the statement is completed

advertisements

I am trying select distinct records from mysql db. But i can't able to do this.

Here is the table:

id,  f2,      f3,         f4
1,   a1,      mytext,     t1
2,   a2,      mytext,     t2
3,   a2,      mytext,     t3
4,   a3,      mytext,     t4
5,   a1,      mytext,     t5
6,   a5,      mytext,     t6

I am trying to get the distinct f2 results:

id,  f2,       f3,         f4
3,   a2,      mytext,      t3
4,   a3,      mytext,      t4
5,   a1,      mytext,      t5
6,   a5,      mytext,      t6

Can give me What is the Exact SQL Query?


IF you gave more info then the query could be more optmized and according to your requirements.

SELECT * FROM mytable GROUP BY f2