Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 rewriting my left self join

Author  Topic 

idb65
Starting Member

4 Posts

Posted - 2013-04-30 : 17:23:55
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
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-04-30 : 17:36:56
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
   

- Advertisement -