# rank error in ej

**URL:** <https://forum.kx.com/t/rank-error-in-ej/11713>\
**Category:** Community Support\
**Tags:** kdb-and-q\
**Created:** [March 9, 2018, 12:22am UTC](https://forum.kx.com/t/rank-error-in-ej/11713 "2018-03-09T00:22:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![newstudent20171](https://avatars.discourse-cdn.com/v4/letter/n/c68b51/32.png) [@newstudent20171](https://forum.kx.com/u/newstudent20171)\
**Post date:** [March 9, 2018, 12:22am UTC](https://forum.kx.com/t/rank-error-in-ej/11713/1 "2018-03-09T00:22:00Z")

</div>

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]&nbsp;&nbsp;/ why the rank error ?

---

<div class="post-metadata">

**Author:** ![effbiae](https://avatars.discourse-cdn.com/v4/letter/e/ecae2f/32.png) [@effbiae](https://forum.kx.com/u/effbiae)\
**Post date:** [March 9, 2018, 8:57am UTC](https://forum.kx.com/t/rank-error-in-ej/11713/2 "2018-03-09T08:57:00Z")

</div>

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&nbsp; 3

---

<div class="post-metadata">

**Author:** ![Sean\_Murphy\_Aqu](https://avatars.discourse-cdn.com/v4/letter/s/c68b51/32.png) [@Sean\_Murphy\_Aqu](https://forum.kx.com/u/Sean_Murphy_Aqu)\
**Post date:** [March 9, 2018, 9:04am UTC](https://forum.kx.com/t/rank-error-in-ej/11713/3 "2018-03-09T09:04:00Z")

</div>

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[`c1`c2;t1;t2]'rank [0] ej[`c1`c2;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

---

<div class="post-metadata">

**Author:** ![newstudent20171](https://avatars.discourse-cdn.com/v4/letter/n/c68b51/32.png) [@newstudent20171](https://forum.kx.com/u/newstudent20171)\
**Post date:** [March 9, 2018, 9:07am UTC](https://forum.kx.com/t/rank-error-in-ej/11713/4 "2018-03-09T09:07:00Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![Sean\_Murphy\_Aqu](https://avatars.discourse-cdn.com/v4/letter/s/c68b51/32.png) [@Sean\_Murphy\_Aqu](https://forum.kx.com/u/Sean_Murphy_Aqu)\
**Post date:** [March 9, 2018, 9:28am UTC](https://forum.kx.com/t/rank-error-in-ej/11713/5 "2018-03-09T09:28:00Z")

</div>

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
