Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.



Read-Only Read-Only Topic
Go
Search
Notify
Tools
Combine two tables
 Login/Join
 
<Faisal I Rathor>
posted
I have two tables in SQL server, they both have one field in common. I want to fetch some fields from one table and some other fields from other table on the bases of common field and save the output to third table. I want to do this in Maintain toll.
Anyone assist me how I can do that?
 
Report This Post
Master
posted Hide Post
The easiest way to do this, is to create 3 stacks. The first one retrieves data from file one, the second one from file two, and then add them to the third stack and save them to the database.

Assume
File1 has fieldA, field1, field2, field3.
File2 has fieldA, field4, field5, field6
File3 has fieldA and fields 1 - 6

Then

MAINTAIN FILE FILE1 AND FILE2 AND FILE3
INFER FILE3.fieldA into STACK3
FOR ALL NEXT FILE1.fieldA into STACK1
WHERE FILE1.fieldA = val -* criteria goes here
FOR ALL NEXT FILE2.fieldA into STACK2
WHERE FILE2.fieldA = val
COMPUTE I/I3=1;
REPEAT STACK1.FOCCOUNT
COMPUTE STACK3(I).fieldA = STACK1(I).fieldA;
COMPUTE STACK3(I).field1 = STACK1(I).field1;
COMPUTE STACK3(I).field2 = STACK1(I).field2;
COMPUTE STACK3(I).field3 = STACK1(I).field3;
COMPUTE STACK3(I).field4 = STACK2(I).field4;
COMPUTE STACK3(I).field5 = STACK2(I).field5;
COMPUTE STACK3(I).field6 = STACK2(I).field6;
COMPUTE I=I+1;
ENDREPEAT
FOR ALL FILE3.INCLUDE fieldA from STACK3;
END

This assume that the formats of the fields in File1, File2 and File3 are the same. It also assumes that the rows from File1 and File2 have the one key (fieldA) and the same number of rows.

Mark
 
Posts: 663 | Location: New York | Registered: May 08, 2003Report This Post
Guru
posted Hide Post
You may also want to take a look at MATCH FILE, MORE and FILEDEF. These functions can all do what you want.
 
Posts: 406 | Location: Canada | Registered: May 31, 2004Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic


Copyright © 1996-2020 Information Builders