How to find total no. of records in a table having same info

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
shahnawaz
Forum Newbie
Posts: 1
Joined: Sun Dec 21, 2008 10:42 pm

How to find total no. of records in a table having same info

Post by shahnawaz »

Hi,

i just want to find out total no. of records in a table which is having same information in some fields of table mean matching information in the fields. i can elaborate it as suppose i have a survey table which is having 4 answers fields and there are thousands of records in that table, i want to know how many people have given same answers.

Please help me to write db query.
Thanks
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: How to find total no. of records in a table having same info

Post by jaoudestudios »

What do you have so far?

You will need something like this...

Code: Select all

 
$q = "SELECT COUNT(id) AS total FROM *table* WHERE q1 = '".$a1."' AND ....";
 
Post Reply