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

  • Home
  • SEARCH
  • 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 8545469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:47:54+00:00 2026-06-11T12:47:54+00:00

Table kal id integer primary key init char 4 indexed job char4 id init

  • 0
Table kal
id integer primary key
init char 4 indexed
job char4

id  init job
--+----+------
1 | aa | job1
2 | aa | job2
3 | bb | job1
4 | cc | job3   
5 | cc | job5

I want to show all rows where init has more than one row:

id  init job
--+----+------
1 | aa | job1
2 | aa | job2
4 | cc | job3   
5 | cc | job5

I tried:

select * from kal where init in (select init from kal group by init having 
count(init)>2);

Actually, the table has 60000 rows, and the query was

count(init)<40, 

but it takes a humongous amount of time, phpmyadmin and my patience runs out.

Both

select init from kal group by init having count(init)>2)

and

select * from kal where init in ('aa','bb','cc')

runs in “no time”, less than 0.02 seconds.

I’ve tried different subqueries, but all takes “infinite” time, more than a few minutes; I’ve actually never let them finish.

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

    Here’s an example, and you can see it in action:

    Query

    SELECT a.id, a.init, a.job
    FROM kal a
    INNER JOIN
      (SELECT init, COUNT(init) 
      FROM kal
      GROUP BY init
      HAVING COUNT(init) > 1) b ON b.init = a.init
    

    Result

    | ID | INIT |  JOB |
    --------------------
    |  1 |   aa | job1 |
    |  2 |   aa | job2 |
    |  4 |   cc | job3 |
    |  5 |   cc | job5 |
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

table : id (integer primary key) data (blob) I use mysql and sqlalchemy. To
Table defintion is create table users ( serial_no integer PRIMARY KEY DEFAULT nextval('serial'), uid
Table: Relatives emp_id dep_id (composite primary key) We have to restrict one employee to
table 'sample' contaning fields [AffiliateId] as a primary key, [AffiliateCode] L, [Name] , [AddressId]
Table name: Author AuthorID -> primary key FirstName LastName Table name: Titles ISBN ->
Table A has two columns: ID and name I want to input 3 ID
Table is huge. For testing application I want to delete all, except 1000 records
table data of 2 columns category and subcategory i want to get a collection
Table: UserId, Value, Date. I want to get the UserId, Value for the max(Date)
Table with Unique Clustered Index and an Indexed View are stored in same way.

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.