Focal Point
[CLOSED] Join -> sum to high

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

August 09, 2018, 08:39 AM
jenni
[CLOSED] Join -> sum to high
Problem:
I got a table. in that table i sum a value -> No Problem. As a plus Information, I Need to join another table on mine, sothat my join seems to be not unique?

when i use Distinct, then there's the Problem when there really is a double value, not because of the join...

This message has been edited. Last edited by: FP Mod Chuck,


WebFOCUS 8.1.05
Windows, All Outputs
August 09, 2018, 08:54 AM
BabakNYC
Are you tables in a SQL dbms or hold files? I'm not sure if I understand what's happening.


WebFOCUS 8206, Unix, Windows
August 09, 2018, 09:25 AM
jenni
DBMS.

When I join the table, my Sum is greater then before, eventhough there are the same numbers of records. It's a unique join.. Don't know where the Problem is..


WebFOCUS 8.1.05
Windows, All Outputs
August 09, 2018, 09:31 AM
BabakNYC
Add the following to the beginning of your code in the text editor. It will turn on the trace and show you the SQL SELECT it's sending to your DBMS. That'll give you a better idea of what's happening.

  
-SET &ECHO=ALL;
SET XRETRIEVAL=OFF
SET EMPTYREPORT=OFF

-*** Show SQL statements
SET TRACEON    = STMTRACE//CLIENT

-*** Show SQL generated statement trace
-*SET TRACEON = STMTRACE/1/CLIENT

-*** Show SQL generated sub-statement trace
SET TRACEON    = STMTRACE/2/CLIENT

-*** Disable the trace stamp (Date/Time etc)
SET TRACESTAMP = OFF

-*** Set trace line wrapping - # of characters
SET TRACEWRAP  = 132

-*** Activate SQL tracing
SET TRACEUSER  = ON



WebFOCUS 8206, Unix, Windows
August 09, 2018, 11:00 AM
MartinY
Pay attention, Focus unique JOIN may not react the way you think it does when thinking of SQL unique JOIN.

What you think that is a unique JOIN may result in a "Cartesian" one in Focus. You may need to add a condition (another key field) in your JOIN or a WHERE clause in the TABLE file request.

But as Babak suggest, look at the generated SQL


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007