Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Regds. Outer join...

Posted on 2006-11-22
5
Medium Priority
?
284 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 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 150 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

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

In this article, I’ll look at how you can use a backup to start a secondary instance for MongoDB.
In this article, we’ll look at how to deploy ProxySQL.
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…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

824 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