[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to convert simple Oracle SQL statement into MS SQL Server SQL statement

Posted on 2007-10-04
1
Medium Priority
?
238 Views
Last Modified: 2010-03-20
I want to convert sql statement from oracle sql to ms sql server sql:
select *
from REN
where (ko,st_pc,stev_pc,imen_pc) not in (
            select  ko,st_pc,stev_pc,imen_pc
            from REN
            where raba_id = 1
              and POV_KS > 70)
0
Comment
Question by:Premanidhi
1 Comment
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 20012691
the following 2 options should work in both oracle AND ms sql server:

select *
from REN t
left join REN o
  on t.ko = o.ko
 and t.st_pc = o.st_pc
 and t.stev_pc = o.stev_pc
 and t.imen_pc = o.imen_pc
 and o.raba_id = 1
 and o.pov_ks > 70
where o.ko is null


or:

select *
from REN t
where not exists (
 select null
  from REN o
 where t.ko = o.ko
 and t.st_pc = o.st_pc
 and t.stev_pc = o.stev_pc
 and t.imen_pc = o.imen_pc
 and o.raba_id = 1
 and o.pov_ks > 70
)
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
Screencast - Getting to Know the Pipeline
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question