Fórum Select Remetente e Destinatario mesma tabela #387819
04/10/2010
0
where (lct.MOV_DATLAN between :p1 and :p2) O retorno da instrucao acima traz nome iguais para remetente e destinatario. Desde já agradeço,
Eremita
Curtir tópico
+ 0Posts
04/10/2010
Eduardo Marcolongo
select lct.MOV_NROLAN, lct.MOV_DATLAN, rem.CLI_NOME, des.CLI_NOME from MOVIMENTO lctinner join CLIENTES rem on rem.CLI_ID = lct.MOV_IDREMinner join CLIENTES des on des.CLI_ID = lct.MOV_IDDES where (lct.MOV_DATLAN between :p1 and :p2) select lct.MOV_NROLAN, lct.MOV_DATLAN, (select clientes.cli_nome from cliente where clientes.cli_ID = lct.mov_idrem) as remetente, (select clientes.cli_nome from cliente where clientes.cli_ID = lct.mov_iddes) as destinatario from MOVIMENTO lctwhere (lct.MOV_DATLAN between :p1 and :p2)
Gostei + 0
04/10/2010
Wilson Junior
Espero ter colaborado.
Gostei + 0
04/10/2010
Eremita
MOVIMENTO lct
where (lct.MOV_DATLAN between :p1 and :p2) Quanto aos dados estarem diferentes dentro da tabela, estão sim
Gostei + 0
04/10/2010
Aroldo Zanela
Espero ter colaborado.
select lct.MOV_NROLAN, lct.MOV_DATLAN, rem.CLI_NOME, des.CLI_NOME from MOVIMENTO lct inner join CLIENTES rem on rem.CLI_ID = lct.MOV_IDREM inner join CLIENTES des on des.CLI_ID = lct.MOV_IDDES where (lct.MOV_DATLAN between :p1 and :p2)
Gostei + 0
05/10/2010
Eremita
CLI_ID
CLI_NOME CLI_CIDADE
COB_ID
Tabela movimento
MOV_NROLAN
MOV_DATLAN
MOV_IDREM
MOV_IDDES MOV_IDPAG #Código select
lct.MOV_NROLAN,
lct.MOV_DATLAN,
rem.CLI_NOME,
des.CLI_NOME , pag.CLI_CIDADE, cob.COB_DESCRICAO
from
MOVIMENTO lct
inner join
CLIENTES rem
on
rem.CLI_ID = lct.MOV_IDREM
inner join
CLIENTES des
on
des.CLI_ID = lct.MOV_IDDES
inner join
CLIENTES pag
on
pag.CLI_IDPAG = lct.MOV_IDPAG where
(lct.MOV_DATLAN between :p1 and :p2) Desde já agradeço,
Gostei + 0
05/10/2010
Eriley Barbosa
lct.MOV_NROLAN,
lct.MOV_DATLAN,
rem.CLI_NOME,
des.CLI_NOME , pag.CLI_CIDADE, cob.COB_DESCRICAO
from
MOVIMENTO lct,
CLIENTES rem , CLIENTES des ,
CLIENTES pag
where rem.CLI_ID = lct.MOV_IDREM
and des.CLI_ID = lct.MOV_IDDES
and pag.CLI_IDPAG = lct.MOV_IDPAG and pag.COB_ID = cob.COB_ID and lct.MOV_DATLAN between :p1 and :p2 Mas se quiser continuar com inner join, tente assim: select
lct.MOV_NROLAN,
lct.MOV_DATLAN,
rem.CLI_NOME,
des.CLI_NOME , pag.CLI_CIDADE, cob.COB_DESCRICAO
from
MOVIMENTO lct
inner join
CLIENTES rem
on
rem.CLI_ID = lct.MOV_IDREM
inner join
CLIENTES des
on
des.CLI_ID = lct.MOV_IDDES
inner join
CLIENTES pag
on
pag.CLI_IDPAG = lct.MOV_IDPAG inner join COBRANCA cob on pag.COB_ID = cob.COB_ID where
lct.MOV_DATLAN between :p1 and :p2
Gostei + 0
05/10/2010
Aroldo Zanela
Gostei + 0
05/10/2010
Eriley Barbosa
lct.MOV_NROLAN,
lct.MOV_DATLAN,
rem.CLI_NOME,
des.CLI_NOME , pag.CLI_CIDADE, cob.COB_DESCRICAO
from
MOVIMENTO lct,
CLIENTES rem , CLIENTES des ,
CLIENTES pag, COBRANCA cob
where rem.CLI_ID = lct.MOV_IDREM
and des.CLI_ID = lct.MOV_IDDES
and pag.CLI_IDPAG = lct.MOV_IDPAG and pag.COB_ID = cob.COB_ID and lct.MOV_DATLAN between :p1 and :p2 Mas se quiser continuar com inner join, tente assim: select
lct.MOV_NROLAN,
lct.MOV_DATLAN,
rem.CLI_NOME,
des.CLI_NOME , pag.CLI_CIDADE, cob.COB_DESCRICAO
from
MOVIMENTO lct
inner join
CLIENTES rem
on
rem.CLI_ID = lct.MOV_IDREM
inner join
CLIENTES des
on
des.CLI_ID = lct.MOV_IDDES
inner join
CLIENTES pag
on
pag.CLI_IDPAG = lct.MOV_IDPAG inner join COBRANCA cob on pag.COB_ID = cob.COB_ID where
lct.MOV_DATLAN between :p1 and :p2
Gostei + 0
05/10/2010
Eremita
Gostei + 0
05/10/2010
Eriley Barbosa
Gostei + 0
05/10/2010
Eremita
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)