SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 rewriting my left self join
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

idb65
Starting Member

4 Posts

Posted - 04/30/2013 :  17:23:55  Show Profile  Reply with Quote
Hello my dear Friends

I have to tables

country : name,code,...
borders:country1,country2

now i want to know if borders table is asymetrical , symetrical means for every country if there is a (fr,de) record in borders, there also should be ((de,fr) , otherwise it is asymetrical.

so i think i should have a join between these two tables,

SELECT NVL2 ( b.country1
, 'No'
, 'Yes'
)
FROM borders a
LEFT OUTER JOIN borders b ON b.country1 = a.country2
AND b.country2 = a.country1


now its writing some "yes" ...

but it should not generate a lot of record but just print out 'yes' or 'no'
if there is at least one Yes, the answer is Yes, if there are just No, the answer is No.

im using oracle 11g

thank you so much for your help
best regards

James K
Flowing Fount of Yak Knowledge

3326 Posts

Posted - 04/30/2013 :  17:36:56  Show Profile  Reply with Quote
This forum is for Microsoft SQL Server, so there are very few experts on Oracle here. You would get better and faster responses at an Oracle forum.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000