Solved

Regds. Outer join...

Posted on 2006-11-22
5
277 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Creating and Managing Databases with phpMyAdmin in cPanel.
Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
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…

756 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