Hi,
At 07:56 AM 03/05/2002 -0500, you 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.

Sure it will.  But the original post requires one row for each cont_id even
if there are multiple rows with the cont_id.  I feel eliminating the HAVING
clause from the query would be the exact solution.

SELECT cont_id, this, that, theother
FROM tblFOO
GROUP BY cont_id

Anvar.

>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

Reply via email to