Focal Point
[CLOSED] JOIN Issue

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

July 30, 2011, 02:48 PM
Poryes
[CLOSED] JOIN Issue
Hi I am trying to JOIN 2 tables eg TABA and TABB.

But its only joining TABA fields with the first record of my TABB extract file.

JOIN STATE IN TABA TO ALL STATE IN TABB

TABLE FILE TABA
PRINT STATE SRC TAXG TAXT TAXA AMT
END

STATE SRC TAXG TAXT TAXA AMT
----- ---- ---- ---- ---- ---
NY A100 030 80 7 12.11
NY D100 - - - -
NY W500 - - - -
NY Z900 - - - -

Pleas help to resolve the issue.

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


WebFOCUS 7.6.13

Mainframe
all output (Report in mainframe)
July 31, 2011, 12:30 PM
Amar
Try using WHERE condition.

WHERE TABA.STATE EQ TABB.STATE

May be it will help


WebFOCUS 7.6.4, Mainframe Focus
Mainframe / Z/OS,MVS
Managed Reporting / Windows
All formats
July 31, 2011, 06:01 PM
Waz
What is the source of the two tables ?

Are they from an RDBMS or FOCUS files, or Flat files ?


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

July 31, 2011, 10:03 PM
j.gross
Sounds like flat files, with only one NY record in the second (joined-to) file.

If it's a join to a FIX file, the result is correct for a one-to-many JOIN

In a one-to-many join to a flat file, if there were several matching records in the second file they would all be coupled to the first NY record in the first file, and for subsequent NY records in the first file the cupboard would be bare (since the process does not backspace the second file).

Procedurally, Focus reads forward in the second file, after the first match, until it encounters a non-NY keyed record. It then sits on that record waiting for a record in the first file that matches it.

So any additional NY records in the first file would show no match, whether the second file contains zero, one, or several records keyed to NY.

Bottom line: Remove "ALL" from the JOIN.


- Jack Gross
WF through 8.1.05
August 01, 2011, 04:47 AM
GamP
If these suggestions did not help, please post both master files. That way we can certainly help you better.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
August 01, 2011, 09:38 AM
Gizmo
TABA and TABB are not in the same sort order. They either need to both be sorted by STATE, or your TABB extract will need to have an index.

ON TABLE HOLD AS TABB FORMAT FOCUS INDEX STATE




Windows: WF 7.6.2: SQL Server 2008 R2