Re: I need to better understand how to use self joins
It's not my schema so I can't change it.
I have cut the query time in half by eliminating one of the dependent queries and moving the where to the first part of the query.
SELECT DISTINCT substring_index(hostname,'-',-1) AS site
FROM `hosts`
WHERE hostname like 'TERM%' and
substring_index(hostname,'-',-1) NOT IN
(
SELECT DISTINCT substring_index(hostname,'-',-1) FROM `hosts` WHERE hostname LIKE 'SERV%'
)
I guess I'll have to live with that.
Thanks for the feedback.
Shawn
Subject
Written By
Posted
Re: I need to better understand how to use self joins
April 24, 2012 01:05PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.