MySQL Forums
Forum List  »  Newbie

Re: Exclude multiple rows
Posted by: Andrew Gilfrin
Date: July 26, 2005 10:47AM

you can either use group to filter out the duplicates or use distinct. I'd say distinct would be more appropriate.

mysql> select * from test_dup;
+--------+------+
| emp_id | name |
+--------+------+
| 1 | Dave |
| 1 | Dave |
| 1 | Dave |
| 2 | Mike |
+--------+------+
4 rows in set (0.00 sec)

mysql> select distinct * from test_dup;
+--------+------+
| emp_id | name |
+--------+------+
| 1 | Dave |
| 2 | Mike |
+--------+------+
2 rows in set (0.00 sec)

In effect the distinct is grouping by all the columns in the table.

Andrew Gilfrin
------------------
http://gilfster.blogspot.com
My MySQL related Blog

http://www.mysqldevelopment.com
MySQL Stored Procedure,Trigger, View.... (Just about most things these days) Information

Options: ReplyQuote


Subject
Written By
Posted
July 26, 2005 09:40AM
Re: Exclude multiple rows
July 26, 2005 10:47AM
July 27, 2005 01:41AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.