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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T12:26:58+00:00 2026-06-07T12:26:58+00:00

I have the following code select ID, count(*) from ( select ID, service type

  • 0

I have the following code

select ID, count(*) from 
( select ID, service type from database
group by 1,2) suba 
group by 1 
having count (*) > 1

And I get a table where i see the IDs and a count of changes. Similar to this

ID     |   Count(*)
5675   |   2
5695   |   3
5855   |   2
5625   |   4
5725   |   3

Can someone explain to me how to count all the count(*) into groups such that i get a table similar to…

count (*)   | number
2 | 2
3 | 2
4 | 1

and so forth. Can someone also explain to be me what suba means?

MY NEWEST CODE:


select suba.id, count(*) from
( select id, service_type from table_name
group by 1,2) as suba
group by 1
having count (*) > 1

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

    Haven’t tried it, but I think this should work

     select NoOfChanges, count (*) from
     ( 
         select suba.id, count(*) as NoOfChanges from 
          ( select id, service_type from table_name
           group by 1,2) as  suba
           group by 1 
           having count (*) > 1 
        )
     subtableb
     group by NoOfChanges 
    

    You can think of that as

    select NoOfChanges, count (*) from subtableb
    group by NoOfChanges  
    

    but subtableb isn’t a real table, but the results from your previous query

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code: SELECT <column>, count(*) FROM <table> GROUP BY <column> HAVING
I have the following code: SELECT ir.[Id] ,ir.[DriverLicenseNumber] ,COUNT(ir.[ReportNumber]) As [TotatReports] ,ir.[LastName] ,ir.[FirstName] FROM
I have the following code: SELECT c.c_id, c_name, count(h.h_id) AS count FROM c LEFT
I have the following MySQL code: SELECT COUNT(e.eid) AS cnt, e.c_id, c.cdesc FROM e
I have the following code: SELECT q21coding, COUNT(q21coding) AS Count FROM `tresults_acme` WHERE q21
I have the following query: $count = (SELECT COUNT(*) FROM post GROUP BY ID
I have the following mySQL code: SELECT c.categoryId, c.categoryName, c.categoryParent, c.categoryDescription, COUNT(p.productid) as totalProdsInCategory
I Have following code with LINQ var q = (from web in DataContext.Webs select
I have the following code: function isValidAuthor($authorID){ $query = SELECT * FROM jos_users WHERE
I have the following code $result = $handle->select()->from('store_details') ->where('store_details.store_id=?', $id) ->columns('store_details.store_name'); //->query(ZEND_DB::FETCH_OBJ); However, when

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.