Solved

Regds. Outer join...

Posted on 2006-11-22
5
276 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 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: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying 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

Read about achieving the basic levels of HRIS security in the workplace.
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
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…

860 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