Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Qlikview : Conditional join QVD

Hi,

Please give me some input on these :

I have a table 1 (fields : start_time) and table 2 (fields : start_time, end_time)

i wanted to join them like this :

SQL statement :

select *

from table1 a

join table2 b

on a.start_time<= b.start_time AND b.start_time <= a.end_time

qlikview statement :

?

Thanks,

4 Replies
er_mohit
Honored Contributor II

Re: Qlikview : Conditional join QVD

qualify *;

a:

load start_time,

x,

y,

z;

sql select * from a;

join

qualify *;

b:

load start_time,

end_time,

d,

e;

SQL Select *

from b;

new:

load * from a

where a.start_time<= b.start_time AND b.start_time <= a.end_time;

hope it helps

Not applicable

Re: Qlikview : Conditional join QVD

a:

load

rowno() as key,

start_time as start_time_a,

end_time as end_time_a;

sql select * from table a;

b:

join(a)

load

rowno() as key

start_time as start_time_b

end_time as end_time_b

sql select * from table b;

load *

resident a

where start_time_a <= start_time_b  and  start_time_b <= end_time_a

daveamz01
Contributor III

Re: Qlikview : Conditional join QVD

Hi,

You can use intervalmatch. See: http://community.qlik.com/blogs/qlikviewdesignblog/2013/04/04/intervalmatch

Regards,

David

Not applicable

Re: Qlikview : Conditional join QVD

try the below one...

table1:

LOAD a_starttime,a_endtime,'a' as dummy;    
SQL  SELECT * FROM table1 
join table
 
table2

LOAD b_starttime,b_endtime,'a' as dummy;    
SQL  SELECT * FROM table2

table3:

load *
resident table1 where a_starttime<= b_starttime AND b_starttime <= a_endtime

drop tables table1

Community Browser