rank error in ej

I feel super silly asking this.

t1:( c1:1 3 2 )

t2:( c1:1 4 5 )

ej[enlist `c1;t1;t2] / why the rank error ?

ej[`c1;t1;t2]  / why the rank error ?

ej drops `c1 from t2 and q doesn’t allow that ('rank)

this works:

q)t3:( c1:1 4 5;d:3 3 3 )

q)enlist[`c1]_t3

d

3

3

3

and so

q)ej[`c1;t1;t3]

c1 d


1  3

Hey,

In your specific case you are trying to join on the only column in both tables, this is the cause of your rank error.

For example were you to add another column to one table you could then ej on column one.

q)t1:([] c1:1 3 2 )q)t2:([] c1:1 4 5;c2:4 5 7 )q)ej[c1;t1;t2]c1 c2-----1 4`

However were you to then try to ej using both columns of the tables then the rank error would be flagged again.

q)ej[c1c2;t1;t2]'rank [0] ej[c1c2;t1;t2] ^

This is because there is no new column from the right hand table to add to the left hand table.

Thanks,

Seán

I tired this ej[(,);t1;t2] but still same issue.
So how do you do an ej with 1 column table s or is ej not meant for it ?

There is no need for a join when using one column tables as its more of a comparison problem then an addition of data.

Something like:

q)t1:([] c1:1 3 2 )q)t2:([] c1:1 4 5 )q)t1 inter t2c1--1

Should get the required results in your case.

Hope this helps!

Seán