I have a table user_quotes with the fields quotes_id, quotes_user, quotes_desc, quotes_date, quotes_status, quotes_location
. In this quotes_user
allows duplication entries. when i execute my query i am trying to avoid duplication entries of quotes_user
. so I executed the query like this,
select distinct quotes_user from user_quotes;
This query returning only quotes_user
field. How can I retrieve all other records using distinct quotes_user
.
I have tried with these following,
select distinct quotes_user, quotes_desc, quotes_date, quotes_status from user_quotes;
Its not avoiding the duplication of quotes_user.
If i use,
select distinct quotes_user, * from user_quotes;
I am getting mysql error,
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '* FROM `user_quotes`
Any Ideas how can i fetch all records using select distinct of a single column in a same table. I am storing the email address in the field. the datatype is varchar. Thanks.
Note : Pls dont suggest me other types like group by or other. I need to know how can i retrieve the records by only using distinct. thanks.