Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Como faço para contar valores que existem em uma tabela mas não existem em uma determinada tabela?
Tenho as seguintes tabelas:
Tabela(1):
A,
B,
C,
D
Tabela(2):
A,
A,
A,
C,
C,
Gostaria de exibir através de um objeto texto o resultado = 2, sendo os valores não encontrados na tabela (2), ou seja, B e D
Try the following...
=======================
Table1:
LOAD * INLINE [
key,Table1_Val
A,A
B,B
C,C
D,D
]
;
join
//Table2:
LOAD * INLINE [
key,Table2_Val
A,A
A,A
A,A
C,C
C,C
]
;
aggr:
Load
key,Table1_Val,
Table2_Val,
if(isnull(Table2_Val),1,0) as NullValueFlag,
if(isnull(Table2_Val),key,Null()) as NullValue
resident Table1
;
drop table Table1;
=========================
o en tu idioma...
============================
Tente o seguinte ...
Tabela 1:
CARGA * INLINE [
chave , Table1_Val
A, A
B , B
C, C
D , D
]
;
juntar
// Tabela2 :
CARGA * INLINE [
chave , Table2_Val
A, A
A, A
A, A
C, C
C, C
]
;
aggr :
carga
chave , Table1_Val ,
Table2_Val ,
se ( isnull ( Table2_Val ) , 1,0) como NullValueFlag ,
if ( isnull ( Table2_Val ) , chave, Null ()) como NullValue
residente Table1
;
drop table Tabela 1 ;
===============================
Avisas si ayude.
Simon
Try the following...
=======================
Table1:
LOAD * INLINE [
key,Table1_Val
A,A
B,B
C,C
D,D
]
;
join
//Table2:
LOAD * INLINE [
key,Table2_Val
A,A
A,A
A,A
C,C
C,C
]
;
aggr:
Load
key,Table1_Val,
Table2_Val,
if(isnull(Table2_Val),1,0) as NullValueFlag,
if(isnull(Table2_Val),key,Null()) as NullValue
resident Table1
;
drop table Table1;
=========================
o en tu idioma...
============================
Tente o seguinte ...
Tabela 1:
CARGA * INLINE [
chave , Table1_Val
A, A
B , B
C, C
D , D
]
;
juntar
// Tabela2 :
CARGA * INLINE [
chave , Table2_Val
A, A
A, A
A, A
C, C
C, C
]
;
aggr :
carga
chave , Table1_Val ,
Table2_Val ,
se ( isnull ( Table2_Val ) , 1,0) como NullValueFlag ,
if ( isnull ( Table2_Val ) , chave, Null ()) como NullValue
residente Table1
;
drop table Tabela 1 ;
===============================
Avisas si ayude.
Simon
Perfeito! funcionou!
gracias!