Solved

Regds. Outer join...

Posted on 2006-11-22
5
272 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
5 Comments
 
LVL 142

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 142

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

CCModeler offers a way to enter basic information like entities, attributes and relationships and export them as yEd or erviz diagram. It also can import existing Access or SQL Server tables with relationships.
Creating and Managing Databases with phpMyAdmin in cPanel.
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…

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now