Jump to content

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


shahnawaz

Recommended Posts

Hi,

 

i just want to find out total no. of records in a table which is having same information in some fields of that 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

 

Link to comment
Share on other sites

It sounds like you can use "group by" for this.  Eg

 

SELECT a1, a2, a3, a4, count(*) FROM tab
GROUP BY a1, a2, a3, a4
HAVING count(*) > 1

 

That will give you a list of all sets of answers which appeared more than once in the table, and a count of each.  Is that what you want?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.