Subject Order by INDEX
Author Julio Cesar
I have this statement
SELECT CT.DOCUMENTO, FO.FORNECEDOR_ID, CT.DT_EMISS, CT.DT_VENC,
COALESCE(FO.RAZAO_SOC, FO.DESCRICAO) AS FORNECEDOR,
FO.UF_IE, CT.VALOR, CT.DOC_ORIGEM,
CT.VALOR_PAGO, CT.DT_QUIT,
(CT.VALOR + CT.ACRESCIMO - CT.DESCONTO - CT.VALOR_PAGO) VLABERTO,
PC.PCONTA_ID, (PC.PCONTA_ID||' - '||PC.DESCRICAO) PCONTA,
S.SUBCONTA_ID, (S.SUBCONTA_ID||' - '||S.DESCRICAO) SUBCONTA,
F.FORM_PGTO_ID, (F.FORM_PGTO_ID||' - '||F.DESCRICAO) FORMPGTO,
(CURRENT_DATE - CT.DT_VENC) AS DIAS_ATRAZO
FROM CT_PAGAR CT, FORNECEDORES FO, PCONTAS PC, SUBCONTAS S, FORM_PGTO F
WHERE (FO.FORNECEDOR_ID = CT.FORNECEDOR_ID) AND
(PC.PCONTA_ID = CT.PCONTA_ID) AND
(S.PCONTA_ID = CT.PCONTA_ID) AND
(S.SUBCONTA_ID = CT.SUBCONTA_ID) AND
(F.FORM_PGTO_ID = CT.FORM_PGTO_ID) AND
(CT.SITUACAO <> 'PG') AND
(CT.DT_EMISS BETWEEN '10/01/2003' AND '11/10/2003')
ORDER BY 13, CT.DT_VENC, CT.DT_EMISS

d'ont raise any exception, but don't return any row, if I remove the index
13 from order by work's fine.... I'm wrong or it's a bug??

I'm using FB 1.5.0.4027 RC7/WinXP


Julio Cesar
julio_gyn@...
ICQ: 149863922
Grafcenter Inform�tica LTDA.
Sistemas de Gest�o Comercial