I have two tables. The first looks like this:
The second looks like this:
I would like to join these two tables in such a way that every unit in the 2 table is "assigned" 2 units from the 1 table. For example, Unit 2001 is "assigned" units 1001 and 1002, unit 2002 is "assigned" units 1003 and 1004, and so on. The order is not important, just that two unique units from table 1 are assigned to one unit from table two.
I would like my final product to look something like this:
Unit Status Assignment_1 Assignment_2
2001 Z 1001 1002
2002 T 1003 1004
And so forth.
Any help would be greatly appreciated! Of course if you want to tell me to go take more SQL training, that is fine too!
Thanks!This message has been edited. Last edited by: FP Mod Chuck,
Not sure to understand the purpose of this, but with a few coding I can have the below
TABLE FILE CAR SUM COMPUTE IDXT /I2 = IDXT + 1; NOPRINT COMPUTE IDX /I2 = IF DMOD(IDXT, 2, 'I2') EQ 0 THEN LAST IDXT ELSE IDXT; COMPUTE ROWID /I2 = IF LAST ROWID EQ 1 THEN 2 ELSE 1; BY CAR ON TABLE HOLD AS SRCA END -RUN TABLE FILE CAR SUM COMPUTE IDX/I2 = IF IDX EQ 0 THEN 1 ELSE IDX + 2; BY COUNTRY ON TABLE HOLD AS SRCB FORMAT FOCUS INDEX IDX END -RUN JOIN IDX IN SRCA TO IDX IN SRCB TAG J1 AS J1 END SET ACRSVRBTITL = ON TABLE FILE SRCA SUM CAR AS 'Car' BY COUNTRY AS 'Country' ACROSS ROWID NOPRINT ON TABLE SET PAGE-NUM NOLEAD END -RUN
Please, when posting sample data, format or code, use the tag code (last one on the ribbon) :
WF versions : Prod 18.104.22.168M gen 240, Dev 8.2.04 gen 48, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
|Powered by Social Strata|