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
)
You could use just a subquery instead of two:
but if you want to use just joins, you could use something like this: