Ciao a tutti,
Sto cercando di scavare se esiste già una soluzione per sotto problema.
Dì che ho
Tabella A con 3 colonne "X", "Y" e "Z"
Tabella B con 1 colonna "R"
La colonna R contiene già alcuni valori di X e Y.
Voglio unire la Tabella A e la Tabella B come ---> Colonna di corrispondenza (X = R) OR Colonna di corrispondenza (Y = R)
Può essere fatto con JSL o qualcosa del genere?
Grazie
ariete
Io posso realizzare quello che vuoi con 2 semplici join .... vedi il mio script dove non si sa se un nome in una tabella di dati è il nome o il cognome nell'altra tabella di dati
Names Default to Here(1);
// Create Sample Data
dt1 = New Table( "First and Last names",
Add Rows( 10 ),
New Column("Firstname",Character,
"Nominal",
Set Values(
{"KATIE", "LOUISE", "JANE", "JACLYN", "LILLIE", "TIM", "JAMES", "ROBERT",
"BARBARA", "ALICE"}
)
),
New Column("lastname", Character,
"Nominal",
Set Values(
{"McMillan", "Johnson", "Jones", "Smith", "McDonald", "Carson", "Brady",
"Williams", "Wilt", "Hamilton"}
)
),
New Column( "sex", Character( 1 ),
"Nominal",
Set Values( {"F", "F", "F", "F", "F", "M", "M", "M", "F", "F"} )
),
New Column("height",
Numeric,
"Continuous",
Format( "Fixed Dec", 5, 0 ),
Set Values( [59, 61, 55, 66, 52, 60, 61, 51, 60, 61] )
),
New Column("weight",
Numeric,
"Continuous",
Format( "Fixed Dec", 5, 0 ),
Set Values( [95, 123, 74, 145, 64, 84, 128, 79, 112, 107] )
),
Set Label Columns( :Firstname )
);
dt2 = New Table( "ages",
New Column( "Unknown names",
Character,
"Nominal",
Set Values(
{"KATIE", "LOUISE", "Jones", "JACLYN", "LILLIE", "Carson", "JAMES",
"ROBERT", "Wilt", "ALICE"}
)),
New Column( "age", Numeric,
"Ordinal",
Format( "Fixed Dec", 5, 0 ),
Set Values( [12, 12, 12, 12, 12, 12, 12, 12, 13, 13] )
),
Set Label Columns( :Unknown Names )
);
// Join Firstnames with the unknown names
dt3 = dt1 << Join(
With( dt2 ),
Merge Same Name Columns,
By Matching Columns( :Firstname = :Unknown names ),
Drop multiples( 0, 0 ),
Include Nonmatches( 1, 0 ),
Preserve main table order( 1 )
);
// Join the Lastnames with the unknown names
dt4 = dt3 << Join(
With( dt2 ),
Merge Same Name Columns,
By Matching Columns( :Lastname = :Unknown names ),
Drop multiples( 0, 0 ),
Include Nonmatches( 1, 0 ),
Preserve main table order( 1 )
);