SELECT Count(*) and finding duplicate recs.

SELECT Count(*) and finding duplicate recs.

Post by Jonathan Davi » Fri, 30 Oct 1998 04:00:00

In VFP to find a dup for a certian key, I would:

SELECT key, count(*) as cnt    ;
    from table1    ;
    group by key    ;
    having cnt > 1

In SQL Server how do I name the columns.

I need this for "HAVING" referencing. (If there's a better way - someone
clue me in PLZ!)

Jonthan Davis



Ok, quick question here. I'm wondering if doing a SELECT COUNT(*) is slower
than say selecting a count based on a single column name. If there is a
difference, is it significant? What is the recommended usage of the COUNT()
function? I have been using COUNT(*), but I'm wondering if that takes too
long. Thanks for any help.

Jon Rista

2. Is Everyone Having Trouble with 2000 SP1?

3. select count(1) vs select count(*)

4. Error During Connection of Oracle

5. Re select count(1) vs select count(*)

6. Superset indexing.

7. delete duplicate dBASE recs??

8. Use ODBC connect to SQL Server

9. How to count recs returned by a subquery?

10. Stored Proc to count all recs

11. select statement to find a duplicate key ?

12. Query to find recs between 2 dates and using LIKE and a Wildcard

13. SQL6.5: How to find the missing recs?