I have an issue that I cannot find a solution for. I have searched for Reversing Outer Joins and found multiple threads about errors when importing or transitioning between versions, but nothing related to my issue.
Essentially, I have multiple tables joined together by Outer Joins. Our data quality in our legacy db’s are horrible and this is a must to avoid losing any data elements. I’m defining the Outer Join and the Cardinality Statement is correct. However, when I go to WebI to test it, it reverses all of the Outer Joins and drastically reduces my results.
Example:
dbo.TableA.PackageID = dbo.TableB.PackageID
Outer Join Designated on TableA
Cardinality Statement Reads
“Each dbo.TableA has zero or one dbo.TableB. Each dbo.TableB has one or more dbo.TableA.”
Assumingly, this should create the following SQL Statement
dbo.TableA
LEFT OUTER JOIN dbo.TableB ON dbo.TableA.PackageID = dbo.TableB.PackageID
Unfortunately, it is reversed when I look at the SQL Statement in WebI.
dbo.TableA
LEFT OUTER JOIN dbo.TableB ON dbo.TableB.PackageID = dbo.TableA.PackageID
It only reverses the ON statement.
Also, I have 11 tables with Outer Joins and this only affects 3 of them. Correspondingly, the 8 where I’m not having the issue are in a different Schema and the 3 with the issue are in the same Schema as my main Fact Table.
I would suggest something similar to what Mak1 has suggested, like, try writing a custom SQL (edit the automaticcally generated SQL) and see what happens.
If that is the case, may be you can create a derived table at the universe level that has the (need to be modified SQL) modified SQL in it and create objects using that derived table. So, all the end user may need to do is be aware of this and use those objects from the derived table in their reports.
I really don’t understand what the problem is. Shouldn’t
dbo.TableA
LEFT OUTER JOIN dbo.TableB ON dbo.TableA.PackageID = dbo.TableB.PackageID
and
dbo.TableA
LEFT OUTER JOIN dbo.TableB ON dbo.TableB.PackageID = dbo.TableA.PackageID
return the same result set? What matters is the order of tables in your outer join statement:
dbo.TableA
LEFT OUTER JOIN dbo.TableB ON dbo.TableA.PackageID = dbo.TableB.PackageID
is of course different from
dbo.TableB
LEFT OUTER JOIN dbo.TableA ON dbo.TableA.PackageID = dbo.TableB.PackageID.
or
dbo.TableA
RIGHT OUTER JOIN dbo.TableB ON dbo.TableA.PackageID = dbo.TableB.PackageID
Besides the word “OUTER” is redundant, LEFT OUTER JOIN could (and in my opinion should) be simply written LEFT JOIN. Assuming of course, you are not using Oracle (in which case Webi usually writes sql with that annoying non-ansi (+) notation)
You’re right of course. It’s just that by default it appears to be set to No. Also when you set it to yes, longer syntax is used (“inner join” and “left outer join” instead of just “join” and “left join”). Never found a parameter to change that.
All of that being of course beside the point here…