Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting the number of rows.

Status
Not open for further replies.

altendew

Programmer
Mar 29, 2005
154
US
How could I get mysql to just print the number of rows for this query, because this is currently return hundreds of rows. I just want one row.

I want to know how many duplicate first names there is.

Code:
SELECT COUNT(*) as total FROM members WHERE first!='' GROUP BY first HAVING total>1
 
Code:
select count(*) as dupe_firsts
  from (
       SELECT first
            , COUNT(*) as total 
         FROM members 
        WHERE first!='' 
       GROUP 
           BY first 
       HAVING total > 1
       ) as dupes

r937.com | rudy.ca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top