Subject | Speed of an query with IN select |
---|---|
Author | cornievs |
Post date | 2011-12-27T17:05:35Z |
Is there a way I can speed up the following query?
Select CODE, STKCODE, DESCRIPTION from COUNT_SHEETS_DETAIL where code STARTING WITH 'TPL' and STKCODE in (Select STKCODE from (Select STKCODE, COUNT(STKCODE) as COUNT1 from COUNT_SHEETS_DETAIL where code STARTING WITH 'TPL' GROUP BY STKCODE order by STKCODE ) where COUNT1 > 1) order by STKCODE
Any help would be appreciated.
Regards
Cornie
Select CODE, STKCODE, DESCRIPTION from COUNT_SHEETS_DETAIL where code STARTING WITH 'TPL' and STKCODE in (Select STKCODE from (Select STKCODE, COUNT(STKCODE) as COUNT1 from COUNT_SHEETS_DETAIL where code STARTING WITH 'TPL' GROUP BY STKCODE order by STKCODE ) where COUNT1 > 1) order by STKCODE
Any help would be appreciated.
Regards
Cornie