Vi escreveu:
> preciso de uma ajuda pra melhorar essa query, alguem pode me ajudar?
> 
> 
> SELECT
>     crcid, crcdatvct, crcdocger, crcvlr, clitel, clicobctt, clissp,
> clinomraz, cliid, clicobtel
> FROM
>     cli, crc , ctr
> WHERE
>     (cliid = crccli) and (crcbxd = 'N') and
>     (((crcdocger in (select fatctrfat from fatctr where fatctrctr =
> ctrid)) or (crcdocger = ctrid))) and
>     (crcdatvct >= '2009-11-01') and
>     (crcdatvct <= '2009-11-20') and
>     (crcvlr > '0.00')
> ORDER BY
>     crcdocger ASC, crcdatvct DESC;
> 
O que está "matando" a sua consulta é o IN. Eu te aconselho colocar a tabela
fatctr no FROM também.


-- 
  Euler Taveira de Oliveira
  http://www.timbira.com/
_______________________________________________
pgbr-geral mailing list
[email protected]
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral

Responder a