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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:43:27+00:00 2026-06-14T19:43:27+00:00

From my understanding sub queries will be called everytime a row is looked at

  • 0

From my understanding sub queries will be called everytime a row is looked at and in this case every row will be looked at.

How do i rewrite this query? The subquery only needs to be ran once but i cant think of how to select id when i have to remove ids that only have 1 entry in the group (i want group count>1).

The purpose is to get a list of rows that have the same size as other rows

select id 
from file 
where size in 
    ( 
    select size from 
        (
        select count(*) as c, size 
        from file 
        group by size 
        having c>1 and size>0
        ) as t
    )
  • 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-14T19:43:28+00:00Added an answer on June 14, 2026 at 7:43 pm

    You could use just a subquery instead of two:

    select id 
    from file 
    where size in (
        select size 
        from file 
        group by size 
        having count(*)>1 and size>0
        )
    

    but if you want to use just joins, you could use something like this:

    select distinct file.id
    from file inner join file file1 on file.size = file1.size
    where file.size>0 and file.id <> file1.id
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

From my understanding of the docs this general approach should work: begin try1 rescue
From my understanding, os.popen() opens a pipe within Python and initiates a new sub
I am having problems understanding how best to tackle this query. I have a
From my understanding of the manual for DECIMAL in the mysql docs, it states
From my understanding, the soft keyboard is actually a dialog window that underlies all
From my understanding, each of these methods: get() and put() are atomic. But, when
From my understanding by reading several articles I assumed Process Address Space(PAS) and Virtual
MariaDB 5.3 introduced dynamic columns. From my understanding the next version of mysql should
From what little understanding of Cassandra I have, it seems that data locality is
I have some not understanding actions from gnu clisp Suppose, I have some code

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.