Focal Point
[SOLVED] MS SQL JOIN to WF: join field question

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/3937078216

November 14, 2011, 04:49 PM
gregv
[SOLVED] MS SQL JOIN to WF: join field question
I have a MS SQL statement to translate to WF code where I don't know the join field.
Or is this just a different way to describe a WHERE clause?

INNER JOIN dbo.ReportFilterType AS RFTP ON RFTP.FilterTypeId = @FilterType

Thanks.

This message has been edited. Last edited by: Kerry,



Greg



current client: WF 8.1.05 & 8.2 - Windows 7 64bit - Tomcat 7 - MRE / BID - IE11

local: WF 8.2 - Windows 7 64bit - Tomcat 6 - MRE / BID - FOCUS - IE11

PMF 8
November 15, 2011, 04:04 AM
Wep5622
You could write that condition as a WHERE statement, as long as that INNER JOIN isn't part of a result-set that's brought in using an OUTER JOIN further up in the query.

If it is part of an OUTER JOIN, then putting that condition as a WHERE clause would imply that the OUTER JOIN can't return NULL values and you would effectively turn it into an INNER JOIN by doing so.
In that case you will probably have to write the results of the OUTER JOIN to a separate focus file first and then join that to the rest of the data-set later.

If there's a better way to do that, I'm all ears.
I've seen some reference to "conditional JOINs" too, maybe they would be useful here - the documentation is quite unclear about how to write one of them things. I recall I couldn't get them to work when I tried a while ago.


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
November 15, 2011, 08:02 AM
gregv
Thanks, Wep5622.

There is no Outer Join above this inner join but there are several lower in the query.
I suspect an Outer Join lower in the query would be impacted by this WHERE clause the same as one higher in the query. True?

Thanks.



Greg



current client: WF 8.1.05 & 8.2 - Windows 7 64bit - Tomcat 7 - MRE / BID - IE11

local: WF 8.2 - Windows 7 64bit - Tomcat 6 - MRE / BID - FOCUS - IE11

PMF 8
November 15, 2011, 09:32 AM
Wep5622
No, because in that case the rows where that condition holds true are part of the left-hand side of the join, while the NULL rows from the LEFT OUTER JOIN are at the right-hand side.

You probably don't have any RIGHT OUTER JOINs, those would be impacted if at the right-hand side of this join.


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
November 15, 2011, 10:13 AM
gregv
Great. Thanks Wep5622.
No there are no Right Outer Joins.
Thanks for your help.



Greg



current client: WF 8.1.05 & 8.2 - Windows 7 64bit - Tomcat 7 - MRE / BID - IE11

local: WF 8.2 - Windows 7 64bit - Tomcat 6 - MRE / BID - FOCUS - IE11

PMF 8