473,837 Members | 1,595 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Multiple joins in SQL Server

Hi I have a requirement where in i haev to convert the SQL from Oracle
to the one which will run on the SQL server.

in the Oracle Query i am doing multiple joins, between some 13 tables.
and some of these joins are inner joins and some are Left outer joins.

table1 inner joined with table 2
table2 inner join with table3
table2 inner join with table4
table2 left join with table5
table5 left jin with table6
table6 left jin with table7
table7 left jin with table8
table8 left jin with table9

Any idea how to achieve this??

Jan 4 '08 #1
2 19726
narendra vuradi wrote:
Hi I have a requirement where in i haev to convert the SQL from Oracle
to the one which will run on the SQL server.

in the Oracle Query i am doing multiple joins, between some 13 tables.
and some of these joins are inner joins and some are Left outer joins.

table1 inner joined with table 2
table2 inner join with table3
table2 inner join with table4
table2 left join with table5
table5 left jin with table6
table6 left jin with table7
table7 left jin with table8
table8 left jin with table9
Easy peasy, e.g.

select <list of fields>
from table1
join table2 on table1.a = table2.a
join table3 on table2.b = table3.b
join table4 on table2.c = table4.c
left join table5 on table2.d = table5.d
left join table6 on table5.e = table6.e
left join table7 on table6.f = table7.f
left join table8 on table7.g = table8.g
left join table9 on table8.h = table9.h
Jan 4 '08 #2

Assuming on Oracle you don't face the deprecated (+) syntax it should be
identical since the JOIN syntax is SQL Standard. What fails?

Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Jan 4 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Ed_No_Spam_Please_Weber | last post by:
Hello All & Thanks in advance for your help! Background: 1) tblT_Documents is the primary parent transaction table that has 10 fields and about 250,000 rows 2) There are 9 child tables with each having 3 fields each, their own PK; the FK back to the parent table; and the unique data for that table. There is a one to many relation between the parent and each of the 9 child rows. Each child table has between 100,000 and 300,000
by: Steve | last post by:
I have a SQL query I'm invoking via VB6 & ADO 2.8, that requires three "Left Outer Joins" in order to return every transaction for a specific set of criteria. Using three "Left Outer Joins" slows the system down considerably. I've tried creating a temp db, but I can't figure out how to execute two select commands. (It throws the exception "The column prefix 'tempdb' does not match with a table name or alias name used in the query.")
by: lee_mcknight | last post by:
I am using Crystal Enterprise V9. I have a report that needs to have multiple datasets as the datasource(s) on a single subreport (some common lookup data I need to join to is stored in a seperate dataset). The report is working fine with a single dataset as a datasource, but I cannot seem to find any examples of multiple datasets as a datasource. Is this possible? ReportDocument.SetDatasource() seems to only take a single dataset,...
by: Randy Harris | last post by:
I was inspired by the recent discussion of returning multiple recordsets to ADO from a stored procedure. (Amazed is probably more accurate). I asked about how to accomplish same with Oracle and got a nudge in the right direction from Mr. Kreft. I promised to provide details once working, so here it is. The code is shown below. My next step is to build this technique into my application. I'm hoping for substantial performance gain. ...
by: William | last post by:
ASP.NET on SQL Server I've been asked to quote for developing a system to expose data on a web application. Most of the data will come from SQL Server DBs located on a single box. However, some of the data will be sourced from ORACLE which is located on a different box. It may be necessary to create VIEWS and Stored Procedures joining these DBs Does anyone have any pointers, clues, hints, tips or pitfalls that I might consider...
by: alingsjtu | last post by:
Hello, every body. When execute dynamic generated multiple OPENQUERY statements (which linkes to DB2) in SQLServer, I always got SQL1040N The maximum number of applications is already connected to the database. SQLSTATE=57030. Background: I created a linked server to DB2 8.1 database which called GRR_DB2Server. In my stored procedure p_FetchRawData, I need to read some data from this linked server GRR_DB2Server and insert them into
by: MP | last post by:
Hi trying to begin to learn database using vb6, ado/adox, mdb format, sql (not using access...just mdb format via ado) i need to group the values of multiple fields - get their possible variations(combination of fields), - then act on each group in some way ...eg ProcessRs (oRs as RecordSet)... the following query will get me the distinct groups
by: ntocher | last post by:
Is it possible in a single query to search up to 12 tables for a similar text string and count the number each time a duplicate is found? I have a table for each month with a string field that contains a referer string. table = stats_2007_01 table = stats_2007_02 table = stats_2007_03 and so on.... field = string (200) I can query a single table and return the result i expect with this statement
by: beargrease | last post by:
I'm kind of comfortable with basic joins, but a current project requires a complex query of many tables. The GROUP_CONCAT(DISTINCT ...) function has been very useful as returning my values as comma delimited values when joining multiple tables. I have one table called 'floorplans' which has two fields (floorplan_jpg & floorplan_pdf), I'd like each of these fields to return arrays of the same length (they have the same # of values in the data...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.