I have the following problem, I have a select
using leftJoin
, plus this is returning duplicate records, the database is not duplicated and when I run leftJoin
it works.
Follow SQL
Tabela processo -------------------------------------------- //
idprocesso integer NOT NULL,
nrprocesso character varying(35) COLLATE pg_catalog."default",
nrrefauxiliar character varying(50) COLLATE pg_catalog."default",
idpessoaunidade integer,
idpessoaunidadefat integer,
idpessoacliente integer,
idpessoaclientefat integer,
idpessoaexportador integer,
idpessoaimportacao integer,
idpessoaagente integer,
idservico integer,
idusuario integer,
dtabertura timestamp without time zone,
tprestricao character varying(1) COLLATE pg_catalog."default",
idliberador integer,
dtliberacao timestamp without time zone,
idcancelador integer,
dtcancelamento timestamp without time zone,
txresumomercadoria character varying(80) COLLATE pg_catalog."default",
idmoedamle integer,
vlrmlemneg numeric(18, 6),
vlrmlemnac numeric(18, 6),
idmoedafrete integer,
vlrfreteprepaidmneg numeric(18, 6),
vlrfretecollectmneg numeric(18, 6),
vlrfretenacional numeric(18, 6),
vlrtaxadolar numeric(18, 6),
vlrtaxafrete numeric(18, 6),
vlrtaxamle numeric(18, 6),
vlrcifmneg numeric(18, 6),
vlrcifmnac numeric(18, 6),
idarmazematracacao integer,
idarmazemdesembaraco integer,
idarmazemdta integer,
idembarcacao integer,
nrnumeroviagem character varying(20) COLLATE pg_catalog."default",
nrconhecimento character varying(30) COLLATE pg_catalog."default",
nrconhecmaster character varying(30) COLLATE pg_catalog."default",
idlocalembarque integer,
idlocaldesembarque integer,
idcidadeembarque integer,
idcidadedesembarque integer,
dtconhecimento timestamp without time zone,
dtdesembaraco timestamp without time zone,
dtembarque timestamp without time zone,
dtprevisaoembarque timestamp without time zone,
dtprevisaoentrega timestamp without time zone,
dtprevisaochegada timestamp without time zone,
tpcanal character varying(1) COLLATE pg_catalog."default",
idanalistacomissaria integer,
idanalistacliente integer,
nrpresencacarga character varying(36) COLLATE pg_catalog."default",
dtpresencacarga timestamp without time zone,
nrci character varying(10) COLLATE pg_catalog."default",
nrmanifesto character varying(15) COLLATE pg_catalog."default",
vlrpesoliquido numeric(18, 6),
vlrpesobruto numeric(18, 6),
idincoterm integer,
tpmicdta character varying(1) COLLATE pg_catalog."default",
tpdesembmicdta character varying(1) COLLATE pg_catalog."default",
tpfrete character varying(1) COLLATE pg_catalog."default",
nrplacaveiculo character varying(15) COLLATE pg_catalog."default",
idpessoaestrangeira integer,
ano integer,
idpessoaetranspitl integer,
vlrqtdevolume numeric(18, 6),
tpcarga character varying(2) COLLATE pg_catalog."default",
incargaperigosa character varying(22) COLLATE pg_catalog."default",
maxforcode integer,
snlimontada character varying(1) COLLATE pg_catalog."default",
snlirecuperada character varying(1) COLLATE pg_catalog."default",
tpembarquetrade character varying(1) COLLATE pg_catalog."default",
dtchegada timestamp without time zone,
idmoedaseguro integer,
vlseguromnac numeric(18, 6),
vlrfreteprepaidmnac numeric(18, 6),
vlrfretecollectmnac numeric(18, 6),
vlrfretenacionalreais numeric(18, 6),
vlseguromneg numeric(18, 6),
snrateiocusteio character varying(1) COLLATE pg_catalog."default",
sneventoconclusorrealizado character varying(1) COLLATE pg_catalog."default",
dteventoconclusorrealizado timestamp without time zone,
nrprazoconclusaoprevisto integer,
ideventoconclusor integer,
vlrtaxaseguro numeric(18, 6),
vlrcifdolar numeric(18, 6),
idviatransporte integer,
tpproduto character varying(2) COLLATE pg_catalog."default",
vlrmlemdolar numeric(18, 6),
vlrfreteprepaiddolar numeric(18, 6),
vlrfretecollectdolar numeric(18, 6),
vlrfretenacionaldolar numeric(18, 6),
vlsegurodolar numeric(18, 6),
vlrfreteinternacionalmneg numeric(18, 6),
valorsda numeric(18, 6),
vlassistenciasocial numeric(18, 6),
dtbasesda timestamp without time zone,
tpstatussda character varying(1) COLLATE pg_catalog."default",
idpessoadespachante integer,
idgatewayexterior integer,
idgatewaybrasil integer,
tpestufagem character varying(1) COLLATE pg_catalog."default",
sntarifaminima character varying(1) COLLATE pg_catalog."default",
vlrfretetotalmneg numeric(18, 6),
vlrpesovolumetrico numeric(18, 6),
vlrpesotaxado numeric(18, 6),
vlrtarifafrete numeric(18, 6),
vlrfreteinternacionalmnac numeric(18, 6),
idcomercial integer,
idcomercialservico integer,
idcomercialrota integer,
idpessoaparceiro integer,
idcomissaria integer,
sneventoconclusmantrarealizado character varying(1) COLLATE pg_catalog."default",
observacaosda character varying(2000) COLLATE pg_catalog."default",
idpessoaetransprodov integer,
idpessoatransportadordta integer,
vlotherchargevenda numeric(18, 6),
vlotherchargevendacc numeric(18, 6),
vlotherchargevendapp numeric(18, 6),
vlhousevenda numeric(18, 6),
idarea integer,
nomedofiscal character varying(200) COLLATE pg_catalog."default",
situacaodespacho character varying(200) COLLATE pg_catalog."default",
etapadespacho character varying(200) COLLATE pg_catalog."default",
idultimoeventorealizado integer,
dtultimoeventorealizado timestamp without time zone,
observacaocomercial character varying(1000) COLLATE pg_catalog."default",
observacaogeral character varying(4000) COLLATE pg_catalog."default",
tpembarqueagenciamento character varying(2) COLLATE pg_catalog."default",
observacaoultimofollowup character varying(4000) COLLATE pg_catalog."default",
snetiqueta character varying(1) COLLATE pg_catalog."default",
idpessoaagenteitl integer,
nrdta character varying(20) COLLATE pg_catalog."default",
tpformacomercializacao character varying(1) COLLATE pg_catalog."default",
vlrmlemnegsfrete numeric(18, 6),
vlrmlemnacsfrete numeric(18, 6),
vlrmledolarsfrete numeric(18, 6),
dtalteracaoflw timestamp without time zone,
idpessoaarmador integer,
nrbooking character varying(35) COLLATE pg_catalog."default",
idprocessovinculado integer,
snenviar character varying(1) COLLATE pg_catalog."default",
mmintegracao oid,
shipmentrefid character varying(50) COLLATE pg_catalog."default",
nrregistrocehouse character varying(30) COLLATE pg_catalog."default",
dtregistrocehouse timestamp without time zone,
courier character varying(35) COLLATE pg_catalog."default",
mes integer,
nrexportacao character varying(20) COLLATE pg_catalog."default",
dtexportacao timestamp without time zone,
nrcertificadoda character varying(10) COLLATE pg_catalog."default",
dtconversaoinstrucaoembarque timestamp without time zone,
vlrtarifafretecompra numeric(18, 6),
dtdeadlinedocts timestamp without time zone,
dtdeadlinecarga timestamp without time zone,
nrpastafisicaarquivamento character varying(50) COLLATE pg_catalog."default",
snenviadobysisco character varying(1) COLLATE pg_catalog."default",
dtkeeponholduntil timestamp without time zone,
snpermitirgerarli character varying(1) COLLATE pg_catalog."default",
chaveedi character varying(20) COLLATE pg_catalog."default",
dtrecebimentonum timestamp without time zone,
dtliquidacaofat timestamp without time zone,
dtfaturamento timestamp without time zone,
dtfechamentocambio timestamp without time zone,
tpintegradodta character varying(1) COLLATE pg_catalog."default",
observacaogeralflw character varying(4000) COLLATE pg_catalog."default",
dteventofat timestamp without time zone,
bloqueardesbloquearcc character varying(1) COLLATE pg_catalog."default",
dtentrega timestamp without time zone,
snlicalculada character varying(1) COLLATE pg_catalog."default",
snconsultadosiscarga character varying(1) COLLATE pg_catalog."default",
idarquivamento integer,
dtarquivamento timestamp without time zone,
ideventoconclusorfinanceiro integer,
cdprocessointegracao character varying(30) COLLATE pg_catalog."default",
dtultimaalteracao timestamp without time zone,
notafiscalsaida character varying(200) COLLATE pg_catalog."default",
tpnegociacao character varying(1) COLLATE pg_catalog."default",
dtnotafiscalsaida timestamp without time zone,
tpdivisaoprofit character varying(1) COLLATE pg_catalog."default",
vldivisaoprofit numeric(18, 6),
dtnecessidadefabr timestamp without time zone,
sntarifaminimacompra character varying(1) COLLATE pg_catalog."default",
dtliberacaofaturamento timestamp without time zone,
sneventoconclusorfinanceiro character varying(1) COLLATE pg_catalog."default",
observacaogeralflw1 character varying(4000) COLLATE pg_catalog."default",
vlrfretemneg numeric(18, 6),
vlrfretemnac numeric(18, 6),
vlrfretedolar numeric(18, 6),
vltaxacomercial numeric(18, 6),
valorcalcsobrealiqsda numeric(18, 6),
idpessoaunidadeemissora integer,
idpessoadespachanteregistro integer,
dtdeadlineliberacao timestamp without time zone,
dtliberacaomerc timestamp without time zone,
dtaverbacaodde timestamp without time zone,
snfaturamentolote character varying(1) COLLATE pg_catalog."default",
qtdearquivos integer,
cdprocauxintegracao character varying(100) COLLATE pg_catalog."default",
observacaogeralflw2 character varying(4000) COLLATE pg_catalog."default",
tpcanaldta character varying(1) COLLATE pg_catalog."default",
tpoperacaodta character varying(1) COLLATE pg_catalog."default",
tpoperacaodesembaraco character varying(1) COLLATE pg_catalog."default",
observacaogeral1 character varying(4000) COLLATE pg_catalog."default",
CONSTRAINT processo_pkey PRIMARY KEY (idprocesso),
CONSTRAINT fkf2bc9fe010c4165c FOREIGN KEY (idpessoadespachanteregistro)
REFERENCES public.pessoa (idpessoa) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe016ab3fbb FOREIGN KEY (idgatewayexterior)
REFERENCES public.terminalcarga (idterminalcarga) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe01781405 FOREIGN KEY (idservico)
REFERENCES public.servico (idservico) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe019c697ae FOREIGN KEY (idpessoaunidadeemissora)
REFERENCES public.pessoa (idpessoa) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe01ae2ec90 FOREIGN KEY (idprocessovinculado)
REFERENCES public.processo (idprocesso) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe0227fc645 FOREIGN KEY (idpessoaarmador)
REFERENCES public.pessoa (idpessoa) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe02a35668c FOREIGN KEY (idlocaldesembarque)
REFERENCES public.terminalcarga (idterminalcarga) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe038eeaf58 FOREIGN KEY (idcomercial, idcomercialrota, idcomercialservico)
REFERENCES public.comercialrota (idcomercial, idcomercialrota, idcomercialservico) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe03d71f751 FOREIGN KEY (idpessoaunidade)
REFERENCES public.pessoa (idpessoa) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe03dbb6ccd FOREIGN KEY (idpessoacliente, idanalistacliente)
REFERENCES public.pessoacontato (idpessoa, idcontato) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe03f06a861 FOREIGN KEY (idpessoaexportador)
REFERENCES public.pessoa (idpessoa) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe042683f1b FOREIGN KEY (idviatransporte)
REFERENCES public.viatransporte (idviatransporte) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe042a662ad FOREIGN KEY (idliberador)
REFERENCES public.usuario (idusuario) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe051a6ce3 FOREIGN KEY (idusuario)
REFERENCES public.usuario (idusuario) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe05c1e2f31 FOREIGN KEY (idcomissaria)
REFERENCES public.pessoa (idpessoa) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe05f994388 FOREIGN KEY (idpessoaetransprodov)
REFERENCES public.pessoa (idpessoa) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe0632f8462 FOREIGN KEY (idgatewaybrasil)
REFERENCES public.terminalcarga (idterminalcarga) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe06ac9114b FOREIGN KEY (idcancelador)
REFERENCES public.usuario (idusuario) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe074467c46 FOREIGN KEY (idpessoaclientefat)
REFERENCES public.pessoa (idpessoa) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe0787cea29 FOREIGN KEY (idpessoadespachante)
REFERENCES public.pessoa (idpessoa) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe07e029b12 FOREIGN KEY (idpessoaunidadefat)
REFERENCES public.pessoa (idpessoa) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe081d8c29d FOREIGN KEY (idpessoacliente)
REFERENCES public.pessoa (idpessoa) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe0833a9fc4 FOREIGN KEY (idpessoaagenteitl)
REFERENCES public.pessoa (idpessoa) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe0880158da FOREIGN KEY (idlocalembarque)
REFERENCES public.terminalcarga (idterminalcarga) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe0886a680e FOREIGN KEY (idarmazemdta)
REFERENCES public.armazem (idarmazem) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe08be66c0b FOREIGN KEY (idcidadedesembarque)
REFERENCES public.cidade (idcidade) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe093e7860e FOREIGN KEY (idarmazematracacao)
REFERENCES public.armazem (idarmazem) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe094367ad3 FOREIGN KEY (idincoterm)
REFERENCES public.incoterm (idincoterm) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe094df6067 FOREIGN KEY (idpessoaagente)
REFERENCES public.pessoa (idpessoa) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe09d0fdb69 FOREIGN KEY (idpessoatransportadordta)
REFERENCES public.pessoa (idpessoa) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe09f68fff3 FOREIGN KEY (idarea)
REFERENCES public.area (idarea) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe0a58cf4dd FOREIGN KEY (idarquivamento)
REFERENCES public.arquivamentoprocesso (idarquivamento) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe0b022bf6b FOREIGN KEY (idanalistacomissaria)
REFERENCES public.usuario (idusuario) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe0b13ba25c FOREIGN KEY (idpessoaimportacao)
REFERENCES public.pessoa (idpessoa) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe0b2af2491 FOREIGN KEY (idarmazemdesembaraco)
REFERENCES public.armazem (idarmazem) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe0cc3a9857 FOREIGN KEY (idcidadeembarque)
REFERENCES public.cidade (idcidade) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe0d148aeaa FOREIGN KEY (idpessoaparceiro)
REFERENCES public.pessoa (idpessoa) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe0d245737b FOREIGN KEY (idpessoaetranspitl)
REFERENCES public.pessoa (idpessoa) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe0db022927 FOREIGN KEY (idmoedafrete)
REFERENCES public.moeda (idmoeda) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe0e0258b24 FOREIGN KEY (idpessoaestrangeira)
REFERENCES public.pessoa (idpessoa) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe0e5568143 FOREIGN KEY (idmoedamle)
REFERENCES public.moeda (idmoeda) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe0f261f59f FOREIGN KEY (idultimoeventorealizado)
REFERENCES public.eventos (idevento) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe0f5a26e69 FOREIGN KEY (idembarcacao)
REFERENCES public.embarcacao (idembarcacao) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkf2bc9fe0fa48ef04 FOREIGN KEY (idmoedaseguro)
REFERENCES public.moeda (idmoeda) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
// ------------------------------------------------------------------------------------------
Tabela Area
idarea integer NOT NULL,
aparea character varying(30) COLLATE pg_catalog."default",
cdarea character varying(10) COLLATE pg_catalog."default",
nmarea character varying(60) COLLATE pg_catalog."default",
snativo character varying(6) COLLATE pg_catalog."default",
CONSTRAINT area_pkey PRIMARY KEY (idarea)
//-------------------------------------------------------------------------------------------
Tabela Moeda
idarea integer NOT NULL,
aparea character varying(30) COLLATE pg_catalog."default",
cdarea character varying(10) COLLATE pg_catalog."default",
nmarea character varying(60) COLLATE pg_catalog."default",
snativo character varying(6) COLLATE pg_catalog."default",
CONSTRAINT area_pkey PRIMARY KEY (idarea)
//-------------------------------------------------------------------------------------------
Tabela processodocinstrucaodespacho
idprocesso integer NOT NULL,
idprocessodocinstrucaodespacho integer NOT NULL,
iddocinstrucaodespacho integer,
nrdocinstrucaodespacho character varying(25) COLLATE pg_catalog."default",
dtdocinstrucaodespacho timestamp without time zone,
CONSTRAINT processodocinstrucaodespacho_pkey PRIMARY KEY (idprocesso, idprocessodocinstrucaodespacho),
CONSTRAINT fkcd318617114daa19 FOREIGN KEY (idprocesso)
REFERENCES public.processo (idprocesso) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT fkcd3186173a1c0947 FOREIGN KEY (iddocinstrucaodespacho)
REFERENCES public.docinstrucaodespacho (iddocinstrucaodespacho) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
//---------------------------------------------------------------------------------------------
Tabela diadicao
Follow the code
$process = $db->table('processo')
->whereBetween('dtabertura',[$dateinitial, $dateend])
->where('idpessoacliente', $client)
->leftJoin('viatransporte', function($viatransporte){
$viatransporte->on('processo.idviatransporte', '=', 'viatransporte.idviatransporte')
->whereNotNull('processo.idviatransporte'); })->distinct()
->leftJoin('area', function($area){
$area->on('processo.idarea', '=', 'area.idarea')
->whereNotNull('processo.idarea'); })->distinct()
->leftJoin('moeda', function($moeda){
$moeda->on('processo.idmoedamle', '=', 'moeda.idmoeda')
->whereNotNull('processo.idmoedamle'); })->distinct()
// //Faturas
->leftJoin('processodocinstrucaodespacho', function($processodocinstrucaodespacho){
$processodocinstrucaodespacho->on('processodocinstrucaodespacho.idprocesso', '=', 'processo.idprocesso')
->where('processodocinstrucaodespacho.iddocinstrucaodespacho', '=', 1); })->distinct()
->leftJoin('diadicao', function($diadicao){
$diadicao->on('diadicao.idprocesso', '=', 'processo.idprocesso')
->whereNotNull('diadicao.idprocesso'); })->distinct()
->leftJoin('pessoa', function($pessoa){
$pessoa->on('diadicao.idexportador', '=', 'pessoa.idpessoa')
->whereNotNull('diadicao.idexportador'); })->distinct()
->select('processo.nrprocesso','processo.idusuario', 'processo.idpessoacliente', 'processo.tpestufagem', 'processo.idprocesso','processo.dtcancelamento','processo.dteventoconclusorrealizado', 'processo.vlrmlemneg','processo.tpestufagem','processo.nrconhecimento','processo.dtembarque','processo.dtchegada','processo.dtdesembaraco', 'processo.vlrmlemnac','processo.observacaogeralflw', 'area.aparea', 'moeda.sigla', 'processodocinstrucaodespacho.nrdocinstrucaodespacho', 'pessoa.nmpessoa')
->distinct()
->get();
What would be the problem?