Solved

Regds. Outer join...

Posted on 2006-11-22
5
279 Views
Last Modified: 2008-02-01
Hi,

can any body help me out on this issue...

SELECT Test.ID,
      Test.CalibInstLink,
      Test.VerificationValue,
      Test.LowTolerance,
      Test.HighTolerance,
      Ref.ID,
      Unit.Id,
      Unit.Desc_Lang2,
      Unit.Abbr_Lang2,
      Category.Name2,
      Asset.UsrNumber,
      Asset.Name2
FROM tb_CalibInstTestData Test, tb_CalibInstRef Ref, tb_MeasureUnit Unit, AssetType Category, Asset Asset
      WHERE Test.CalibInstLink IN ( 13 )
      AND Test.ReferenceLink *= Ref.ID
      AND Test.MeasureUnitLink = Unit.ID
      AND Ref.CategoryLink *= Category.AssetTypeID
      AND Ref.ReferenceLink *= Asset.AssetID
ORDER BY Test.CalibInstLink

Server: Msg 301, Level 16, State 1, Line 1
Query contains an outer-join request that is not permitted.

Thanks n Regds.
~ HNS ~
0
Comment
Question by:homnath_sharma
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 18001220
Any better with this syntax:
SELECT Test.ID,
     Test.CalibInstLink,
     Test.VerificationValue,
     Test.LowTolerance,
     Test.HighTolerance,
     Ref.ID,
     Unit.Id,
     Unit.Desc_Lang2,
     Unit.Abbr_Lang2,
     Category.Name2,
     Asset.UsrNumber,
     Asset.Name2
FROM tb_CalibInstTestData Test
INNER JOIN tb_MeasureUnit Unit
  ON Test.MeasureUnitLink = Unit.ID
LEFT JOIN tb_CalibInstRef Ref
     ON Test.ReferenceLink = Ref.ID
LEFT JOIN AssetType Category
     ON Ref.CategoryLink *= Category.AssetTypeID
LEFT JOIN Asset Asset
    ON Ref.ReferenceLink *= Asset.AssetID
WHERE Test.CalibInstLink IN ( 13 )
ORDER BY Test.CalibInstLink
0
 

Author Comment

by:homnath_sharma
ID: 18001264

Hi, I gets below mentioned error, while running your modified query. Please help...

Msg 1016, Level 15, State 3, Server SQLSERVER, Line 21
Outer join operators cannot be specified in a query containing joined tables.

Awaiting for your solution asap.

Thanks in advance..

Regds.
~ HNS ~
0
 
LVL 29

Expert Comment

by:Gautham Janardhan
ID: 18001569
SELECT Test.ID,
     Test.CalibInstLink,
     Test.VerificationValue,
     Test.LowTolerance,
     Test.HighTolerance,
     Ref.ID,
     Unit.Id,
     Unit.Desc_Lang2,
     Unit.Abbr_Lang2,
     Category.Name2,
     Asset.UsrNumber,
     Asset.Name2
FROM tb_CalibInstTestData Test
INNER JOIN tb_MeasureUnit Unit
  ON Test.MeasureUnitLink = Unit.ID
LEFT JOIN tb_CalibInstRef Ref
     ON Test.ReferenceLink = Ref.ID
LEFT JOIN AssetType Category
     ON Ref.CategoryLink = Category.AssetTypeID
LEFT JOIN Asset Asset
    ON Ref.ReferenceLink = Asset.AssetID
WHERE Test.CalibInstLink IN ( 13 )
ORDER BY Test.CalibInstLink

Remove *
0
 
LVL 5

Expert Comment

by:sivachirravuri
ID: 18001574
Note Using this syntax for outer joins is discouraged because of the potential for ambiguous interpretation and because it is nonstandard. Instead, specify joins in the FROM clause.

It is possible to specify outer joins by using join operators in the FROM clause or by using the non-standard *= and =* operators in the WHERE clause. The two methods cannot both be used in the same statement.

Try converting to

select from a left join b on left join c on
etc.
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 50 total points
ID: 18001576
sorry, I forgot to remove the * from the *=  

SELECT Test.ID,
     Test.CalibInstLink,
     Test.VerificationValue,
     Test.LowTolerance,
     Test.HighTolerance,
     Ref.ID,
     Unit.Id,
     Unit.Desc_Lang2,
     Unit.Abbr_Lang2,
     Category.Name2,
     Asset.UsrNumber,
     Asset.Name2
FROM tb_CalibInstTestData Test
INNER JOIN tb_MeasureUnit Unit
  ON Test.MeasureUnitLink = Unit.ID
LEFT JOIN tb_CalibInstRef Ref
     ON Test.ReferenceLink = Ref.ID
LEFT JOIN AssetType Category
     ON Ref.CategoryLink = Category.AssetTypeID
LEFT JOIN Asset Asset
    ON Ref.ReferenceLink = Asset.AssetID
WHERE Test.CalibInstLink IN ( 13 )
ORDER BY Test.CalibInstLink
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

717 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