Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
aviadbein
Contributor II
Contributor II

combining table with itself

Hi all,

I have a table with a single field as below:

LOAD * Inline [

Letter

a

b

c

];

 

Now, I would like to write two  queries which will return:

1) all the possible combinations: 'aa', 'ab', 'ac', 'ba', 'bb', 'bc', 'ca', 'cb', 'cc'

2) only the unique combinations between the values: 'ab' , 'ac', 'bc'

 

Any idea?

Thanks,

Aviad 

Labels (1)
1 Reply
marcus_sommer
MVP
MVP

The following takes all chars and should be helpful how it might be done:

t1: load chr(96 + recno()) as L1 autogenerate 25; join(t1) load chr(96 + recno()) as L2 autogenerate 25;
t2: load L1 & L2 as L3 resident t1 where L1 & L2 follows 'at' and L1 & L2 precedes 'bc';

Just adjust to your real chars and conditions.

- Marcus