Problem: Counting Rows

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
chelflores
Forum Newbie
Posts: 8
Joined: Tue Jun 24, 2008 7:00 pm

Problem: Counting Rows

Post by chelflores »

this is my table:

profile(id,name,fnum)

example in the fmnum field their are 3 rows with the same values.

now i just want to count how many 3 rows with the same values in that table..

can u help me on this...thank you..
User avatar
Darhazer
DevNet Resident
Posts: 1011
Joined: Thu May 14, 2009 3:00 pm
Location: HellCity, Bulgaria

Re: Problem: Counting Rows

Post by Darhazer »

I'm not sure exactly what you are asking for, but you have to look at the group by and having statements

SELECT COUNT(*) AS GroupCount FROM profile GROUP BY fnum HAVING GroupCount = 3
chelflores
Forum Newbie
Posts: 8
Joined: Tue Jun 24, 2008 7:00 pm

Re: Problem: Counting Rows

Post by chelflores »

I just solve my problem a while ago. But thanks anyway :)


This is the query:

SELECT COUNT(*), fmnum FROM db_profile GROUP BY fmnum HAVING COUNT(*) = 3
Post Reply