Subscribe Bookmark RSS Feed

Concurrently accessing 2 columns with the same name from 2 data tables

whom

Community Trekker

Joined:

Jun 23, 2011

I have two data files that have, by design, the same column names. How do I reference each column in an IF statement, to avoid an ambiguous reference...

I want to be able to do something like this....

IF (dt1.weight == dt2.weight,
1 REPLY
pmroz

Super User

Joined:

Jun 23, 2011


style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; color: black; font-family: Helvetica,Arial,sans-serif;">You
can use the column function

style="font-size: 10pt; color: navy; font-family: Helvetica,Arial,sans-serif;">:

style="font-size: 10pt; color: black; font-family: Helvetica,Arial,sans-serif;">


style="font-family: Helvetica,Arial,sans-serif;">



style="font-size: 10pt; font-family: "Courier New"; color: black;">


style="font-size: 10pt; font-family: "Courier New"; color: black;">

 





style="font-size: 10pt; font-family: "Courier New"; color: black;">c1

style="font-size: 10pt; font-family: "Courier New"; color: navy;">=

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">column

style="font-size: 10pt; font-family: "Courier New"; color: black;">(

style="font-size: 10pt; font-family: "Courier New"; color: black;">dt1

style="font-size: 10pt; font-family: "Courier New"; color: navy;">,

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: purple;">"Weight"

style="font-size: 10pt; font-family: "Courier New"; color: black;">)

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="">

style="font-size: 10pt; font-family: "Courier New"; color: black;">
style=""> 

style="font-size: 10pt; font-family: "Courier New"; color: green;">//
refers to weight column in table dt1

style="font-size: 10pt; font-family: "Courier New"; color: black;">







style="font-size: 10pt; font-family: "Courier New"; color: black;">c2

style="font-size: 10pt; font-family: "Courier New"; color: navy;">=

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">column

style="font-size: 10pt; font-family: "Courier New"; color: black;">(

style="font-size: 10pt; font-family: "Courier New"; color: black;">dt2

style="font-size: 10pt; font-family: "Courier New"; color: navy;">,

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: purple;">"Weight"

style="font-size: 10pt; font-family: "Courier New"; color: black;">)

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="">

style="font-size: 10pt; font-family: "Courier New"; color: black;">
style=""> 

style="font-size: 10pt; font-family: "Courier New"; color: green;">//
refers to weight column in table dt2

style="font-size: 10pt; font-family: "Courier New"; color: black;">







style="font-size: 10pt; font-family: "Courier New"; color: black;">c1

style="font-size: 10pt; font-family: "Courier New"; color: navy;"><<

style="font-size: 10pt; font-family: "Courier New"; color: black;">
set selected

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="">  

style="font-size: 10pt; font-family: "Courier New"; color: green;">//
selects column Weight in table dt1

style="font-size: 10pt; font-family: "Courier New"; color: black;">







style="font-size: 10pt; line-height: 115%; font-family: "Courier New"; color: black;">c2

style="font-size: 10pt; line-height: 115%; font-family: "Courier New"; color: navy;"><<

style="font-size: 10pt; line-height: 115%; font-family: "Courier New"; color: black;">
set selected

style="font-size: 10pt; line-height: 115%; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; line-height: 115%; font-family: "Courier New"; color: black;">
style=""> 

style="font-size: 10pt; line-height: 115%; font-family: "Courier New"; color: green;"> //
selects column Weight in dt2




style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="font-family: Helvetica,Arial,sans-serif;">

Regards,


style="font-family: Helvetica,Arial,sans-serif;">

style="font-family: Helvetica,Arial,sans-serif;">Peter



style="font-size: 10pt; font-family: "Courier New"; color: black;">