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
 Is this the Right Forum for SQL question

Author  Topic 

jpsb
Starting Member

3 Posts

Posted - 2008-09-02 : 12:55:15
Is this the correct forum to ask a question about an SQL problem I am having?

thanks

jim s

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2008-09-02 : 12:56:41
for MS SQL ? yes
Go to Top of Page

jpsb
Starting Member

3 Posts

Posted - 2008-09-02 : 13:07:38
My problem is that I am trying to port to MS SQL an I have a very simple Oracle query that I can not write in ANSI1999 SQL

SELECT char_value FROM prefs_mchar a, preferences b
WHERE a.pref_id (+) = b.pref_id;


I was hoping to get some help here.
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2008-09-02 : 13:21:10
try this

SELECT char_value FROM prefs_mchar a, preferences b
WHERE a.pref_id = b.pref_id

Go to Top of Page

acollins74
Yak Posting Veteran

82 Posts

Posted - 2008-09-02 : 13:25:54
I think what you are referring to is a left or right outer join that used to be referred to in MS SQL as *=
If you are connecting to MS SQL 2005 you will have to explicitly write out your join statement as the above has been depricated with ansi-92.
select a.char_value
from prefs_mchar a
left join preferences b
on a.pref_id = b.pref_id

Hope this helps
Go to Top of Page

jpsb
Starting Member

3 Posts

Posted - 2008-09-02 : 14:39:49
thanks for all the replies, I have been digging deeper and I think I am up the creek,
seems that the orginal author used the outer join to create a super set of results and then used ANDs to contrain the results. Discovered at O'Reily that this is no longer possible to do. Or in other words, once the outer join creates the result set it's not possible to reduce it. At least that is my take and seems to be true since adding an add to the query doesn't constrain the result one bit. Hate to have to use a view, but look like I might have too.
Go to Top of Page
   

- Advertisement -