Thank you. This is exactly what I needed. Steve
At 07:56 AM 5/3/2002, Jay Blanchard wrote: >[snip] > Here is probably an easy question to answer, but I can't figure > an EASY >way to do it. Right now, I use a temp table with a unique column to solve >it. I am hoping that there is a way in the SELECT >statement. Anyway....What I want to do is to select records from a table >but if there is more than one with the same cont_id (that is the name of >the column), that it would only select the first one of that id and skip >the rest of that id, but continue with the other rows. > I sure hope that makes since. Only 2 hours of sleep is not good > before >asking for help. >[/snip] > >This query; > >SELECT cont_id, this, that, theother >FROM tblFOO >GROUP BY cont_id >HAVING count(*) = 1 > >will select all records that appear only once in a table according to the >GROUP BY condition. > >This query; > >SELECT cont_id, this, that, theother >FROM tblFOO >GROUP BY cont_id >HAVING count(*) > 1 > >will select all records that are duplicates according to the GROUP BY >condition > >HTH! > >Jay > > >--------------------------------------------------------------------- >Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > >To request this thread, e-mail <[EMAIL PROTECTED]> >To unsubscribe, e-mail <[EMAIL PROTECTED]> >Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php