Page 1 of 1

Problem: Counting Rows

Posted: Wed Jul 22, 2009 8:14 am
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..

Re: Problem: Counting Rows

Posted: Fri Jul 24, 2009 1:06 am
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

Re: Problem: Counting Rows

Posted: Fri Jul 24, 2009 1:12 am
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