MySQL Forums
Forum List  »  General

Re: I need to better understand how to use self joins
Posted by: Peter Brawley
Date: April 24, 2012 03:36PM

I think the exclusion Self-Join version of that would be ...

SELECT DISTINCT substring_index(a.hostname,'-',-1) AS site
FROM hosts a
LEFT JOIN hosts b ON substring_index(a.hostname,'-',-1)=substring_index(b.hostname,'-',-1)
WHERE substring_index(b.hostname,'-',-1) IS NULL;

PB

Options: ReplyQuote


Subject
Written By
Posted
Re: I need to better understand how to use self joins
April 24, 2012 03:36PM


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.