Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Load and sql select

Good morning!
I would like a little help to mount a qvd.
I have the following sql code, composed of temporary tables that result in a third select with these results.

create table tb_tmp as (
select
cod
,ocorrencia
,dat
from tabA
)

;

create table tb_tmp2 as (
select
cod
,ocorrencia
,dat
from tabB
)

;

select
cod
,ocorrencia
,dat
from
(
  select distinct
  t.cod
  ,t.ocorrencia
  ,t.dat
  from
  (
      select * from tb_tmp
  ) t
  ,
  (
      select * from tb_tmp2
  ) t1
where t.cod <> t1.cod
)

I need to create these qvds selects, but I doubt in the formation of the third sql, how to work within a Load sql select command?
Anyone have any tips for this situation?


tb_tmp:
sql
select
cod
,ocorrencia
,dat
from tabA;
store  tb_tmp into tb_tmp.qvd;
drop table tb_tmp;

tb_tmp2:
sql
select
cod
,ocorrencia
,dat
from tabB;
store  tb_tmp2 into tb_tmp2.qvd;
drop table tb_tmp2;

tb_3:
sql
select
cod
,ocorrencia
,dat
from
(
  select distinct
  t.cod
  ,t.ocorrencia
  ,t.dat
  from
  (
      Load * from tb_tmp.qvd
  ) t
  ,
  (
      Load * from tb_tmp2.qvd
  ) t1
where t.cod <> t1.cod
);
store  tb_3 into tb_3.qvd;
drop table tb_3;

Thank's

2 Replies
Gysbert_Wassenaar

Maybe I'm misunderstanding what you're trying to do, but if you want only the records from TabA that have no matching records in TabB, try this:

T1:

select distinct

cod as T1cod

from tabB;

Result:

load * where not exists(T1cod,cod);

select

cod

,ocorrencia

,dat

from tabA;

drop table T1;


talk is cheap, supply exceeds demand
Not applicable
Author

thanks for your help