Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9066609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T16:45:54+00:00 2026-06-16T16:45:54+00:00

I want to get the count how many values are repeating in the result

  • 0

I want to get the count how many values are repeating in the result in a column in result of a query.

The result set I am getting from a complex query is –

svn rvn eng     count(*)
1   1   Boy            1
2   1   Teacher        1
3   1   Chair          1
3   2   Chairwoman      1
3   3   Chairperson     1
4   1   Without         1
4   2   Without fail    1
5   1   Anyone          1
5   2   Anyone else     1
6   1   Permission      1

I just want to get the number of duplicate values in SVN coloumn in fourth coloumn.

i.e.

svn rvn eng     count(*)
1   1   Boy            1
2   1   Teacher        1

3   1   Chair          3
3   2   Chairwoman      3
3   3   Chairperson     3

4   1   Without         2
4   2   Without fail    2

5   1   Anyone          2
5   2   Anyone else     2
6   1   Permission      1

Please Help me out on this, Also please tell me what effect this can cause on the efficiency on the query??

*Note – * I want the count of the values that are picked up in the result set.
there are more entries with svn 1,2,4,6 in the table. but count only how many has been selected.

Thanks in advance 🙂

EDIT1

Here is my current query :-

SELECT `svn` , `rvn` ,`eng` , count(*) FROM 
        (SELECT `svn`, `rvn`, `eng`, `hin` 
              FROM `table1` 
              WHERE `SN` = @sn
            UNION DISTINCT
            SELECT `table1_refer`.`sn_svn` AS 'svn',  
                           `table1`.`rvn`, `table1`.`eng` ,  
                          `vocab_rel`.`hin`
            FROM  `table1` 
            JOIN  `table1_refer` 
            WHERE  `table1_refer`.`rSN` =  `table1`.`SN` 
            AND  `table1_refer`.`svn` =  `table1`.`svn` 
            AND `table1_refer`.`SN` = @sn
        ) AS SUBQUERY
        GROUP BY `svn`,`rvn`
        ORDER BY `svn`, `rvn`
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T16:45:55+00:00Added an answer on June 16, 2026 at 4:45 pm

    You can use a correlated subquery inside your current complex query to do this like so:

    SELECT
      svn, 
      rvn,
      eng,
      (SELECT count(t2.svn)
       FROM Tablename t2
       WHERE t2.svn = t1.svn
      ) AS Count
    FROM Tablename t1
    ....
    

    SQL Fiddle Demo

    This will give you:

    | SVN | RVN |         ENG | COUNT |
    -----------------------------------
    |   1 |   1 |         Boy |     1 |
    |   2 |   1 |     Teacher |     1 |
    |   3 |   1 |       Chair |     3 |
    |   3 |   2 |  Chairwoman |     3 |
    |   3 |   3 | Chairperson |     3 |
    |   4 |   1 |     Without |     2 |
    |   4 |   2 | Withoutfail |     2 |
    |   5 |   1 |      Anyone |     2 |
    |   5 |   2 |  Anyoneelse |     2 |
    |   6 |   1 |  Permission |     1 |
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a table which has many fields but i want to get count
i want to get the count of photos in photoLibrary. Currently, i'am able to
So I want to get the count of the missed calls like the telephonyapplication
I have a MySql table where I want to get the count of rows
I want to get total row count in iReport. The intention is to print
I want to get the page count of the email. I am using Outlook
I want to know how we can get record count using reference cursor in
I want get as much as possible from Redis + Hiredis + libevent. I'm
I have a dictionary with non unique values and I want to count the
I have two tables users registered_members I want to confirm values from user table

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.