Re: Eliminating duplicates from self join results

2007-12-13 Thread Joerg Bruehe
Hi all, I have to follow up on my own mail: Joerg Bruehe wrote: [[...]] For tabular form, try along these lines (untested): SELECT MIN(id), email, id FROM addressbook WHERE id MIN(id) GROUP BY email HAVING COUNT(*) 1 I cannot explain what made me write that, other than lack

Eliminating duplicates from self join results

2007-12-12 Thread Yashesh Bhatia
Hello: I have the following table select * from addressbook +++ | id | email | +++ | 1 | [EMAIL PROTECTED] | | 2 | [EMAIL PROTECTED] | | 3 | [EMAIL PROTECTED] | +++ 3 rows in set (0.00 sec) Now i wanted

Re: Eliminating duplicates from self join results

2007-12-12 Thread Joerg Bruehe
Hi Yashesh, all ! Yashesh Bhatia wrote: Hello: I have the following table select * from addressbook +++ | id | email | +++ | 1 | [EMAIL PROTECTED] | | 2 | [EMAIL PROTECTED] | | 3 | [EMAIL PROTECTED] |

Re: Eliminating duplicates from self join results

2007-12-12 Thread Brent Baisley
Taking it step by step, this query will give you all the lowest ids, for those records with duplicates. SELECT min(id), email, count(*) AS cnt FROM addressbook GROUP BY email HAVING cnt1 Now think of that query as an already existing table, which you can do, you just need to name the query