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 9153903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:20:52+00:00 2026-06-17T12:20:52+00:00

My SQL query returns results with 4 columns A, B, C, D. Suppose the

  • 0

My SQL query returns results with 4 columns “A”, “B”, “C”, “D”.

Suppose the results are:

A    B    C    D
1    1    1    1
1    1    1    2
2    2    2    1

Is it possible to get the count of duplicate rows with columns “A”, “B”, “C” in each row.

e.g. the expected result is:

A    B    C    D    cnt
1    1    1    1    2
1    1    1    2    2
2    2    2    1    1

I tried using count(*) over. But it returns me the total number of rows returned by the query.
Another information is that in example I have mentioned only 3 columns based on which I need to check the count. But my actual query has such 8 columns. And number of rows in database are huge. So I think group by will not be a feasible option here.
Any hint is appreciable.
Thanks.

  • 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-17T12:20:53+00:00Added an answer on June 17, 2026 at 12:20 pm

    Maybe too late, but probably the count over as analytic function (aka window function) within oracle helps you. When I understand your request correctly, this should solve your problem :

    create table sne_test(a number(1)
                     ,b number(1)
                     ,c number(1)
                     ,d number(1)
                     ,e number(1)
                     ,f number(1));
    
    insert into sne_test values(1,1,1,1,1,1);
    insert into sne_test values(1,1,2,1,1,1);
    insert into sne_test values(1,1,2,4,1,1);
    insert into sne_test values(1,1,2,5,1,1);
    insert into sne_test values(1,2,1,1,3,1);
    insert into sne_test values(1,2,1,2,1,2);
    insert into sne_test values(2,1,1,1,1,1);
    
    commit;
    
     SELECT a,b,c,d,e,f, 
           count(*) over (PARTITION BY a,b,c)
      FROM sne_test;
    
     A  B  C  D  E  F AMOUNT
    -- -- -- -- -- -- ------
     1  1  1  1  1  1      1
     1  1  2  4  1  1      3
     1  1  2  1  1  1      3
     1  1  2  5  1  1      3
     1  2  1  1  3  1      2
     1  2  1  2  1  2      2
     2  1  1  1  1  1      1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: PHP SQL, query returns only one row of data A friend of
I'm running a SQL query that returns two columns and X number of rows.
I need a Java function that returns the results of a SQL SELECT query
SQL server 2008 Hello here is my query which returns the result SELECT *
I've got a query that returns a proper result set, using SQL 2005. It
i've got a SQL query which returns multiple rows, and i have : $data
I have a very complex Linq to SQL query that returns a result set
I have an Informix SQL query which returns a set of rows. It was
I have a SQL query that returns a Datatable: var routesTable = _dbhelper.Select(SELECT [RouteId],[UserId],[SourceName],[CreationTime]
I have an SQL query that returns all companies records ignore the ones with

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.