> And COUNT doesn't take any arguments anyway, besides '*', as
> they don't make sense.

On MS SQL Server 2000, one can pass a field name to the COUNT function, and
though I haven't yet seen any difference in the results between the two, the
queries run faster with COUNT(<field>) than with COUNT(*).

Go figure.

> So try this:
>
> SELECT ClientIP, ClientDomain, COUNT(*) AS ClientDomainCount
> FROM SMTPLog
> GROUP BY ClientIP, ClientDomain
> HAVING ClientDomainCount > 1
> ORDER BY ClientDomainCount DESC, ClientDomain ASC

SQL Server also won't let one use the column alias in the HAVING clause, it
must be the same expression that appears in the SELECT list.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to