"Harald Fuchs" <[EMAIL PROTECTED]> writes:
> If you want to select both columns, but have uniqueness over the first
> only, you can use a derived table:
>
> SELECT tbl.name, tbl.comment
> FROM tbl
> JOIN (SELECT name FROM tbl GROUP BY name HAVING count(*) = 1) AS t
> ON t.name = tbl.name
>
Or u
In article <[EMAIL PROTECTED]>,
Phil Rhoades <[EMAIL PROTECTED]> writes:
> People,
>> select count(*) as cnt, name from tst group by name having count(*) = 1
> This worked for my basic example but not for my actual problem - I get
> "column comment must appear in the GROUP BY clause or be used i
Mike,
I can't do that with my comments - I get all six of the records in the
result with the example instead of just four like I want . . but someone
else had a solution without using the "group by" clause . .
Phil.
On Sun, 2008-01-27 at 13:56 -0500, Mike Ginsburg wrote:
> Hi Phil,
> Each of
johnf <[EMAIL PROTECTED]> writes:
> On Sunday 27 January 2008 10:56:18 am Mike Ginsburg wrote:
>> Each of columns that you specify in your SELECT clause, must also
>> appear in the GROPU BY clause.
> Is the requirement of select fields matching group by fields a SQL92
> requirement or something t
On Sunday 27 January 2008 10:56:18 am Mike Ginsburg wrote:
> Hi Phil,
> Each of columns that you specify in your SELECT clause, must also
> appear in the GROPU BY clause.
>
> SELECT COUNT(*) AS cnt, name, comment, ...
> FROM tst
> GROUP BY name, comment, ...
> HAVING COUNT(*) = 1;
>
Is the requir
Hi Phil,
Each of columns that you specify in your SELECT clause, must also
appear in the GROPU BY clause.
SELECT COUNT(*) AS cnt, name, comment, ...
FROM tst
GROUP BY name, comment, ...
HAVING COUNT(*) = 1;
Phil Rhoades wrote:
People,
select count(*) as cnt, name from tst group by nam
People,
> select count(*) as cnt, name from tst group by name having count(*) = 1
This worked for my basic example but not for my actual problem - I get
"column comment must appear in the GROUP BY clause or be used in an
aggregate function" errors so I have a related question:
With table:
nam