Fórum SQL Cabuloso! Tem como eu fazer assim? #55910

03/05/2006

0

Olá, queria fazer mais ou menos assim meu select, mas está dando erro:

select cri.*, vp.qnt_parcela TotalParcela, cl.razao_social NomeCliente,
    case
      when cri.tipo_doc = 0 then ´Duplicata´
      when cri.tipo_doc = 1 then ´Promissória´
      when cri.tipo_doc = 2 then ´Cheque´
      when cri.tipo_doc = 3 then ´Cartão´
      when cri.tipo_doc = 4 then ´Boleto´
      when cri.tipo_doc = 5 then ´Carnê´
      when cri.tipo_doc = 6 then ´Dinheiro´
    end as DescTipoDoc, (coalesce(cri.valor,0) - coalesce(cri.valor_pago,0)) 
as ValorAberto,
    case
      when cri.status = ´A´ then ´Aberto´
      when cri.status = ´F´ then ´Fechada´
      when cri.status = ´P´ then ´Parcial´
    end as DescStatu
 from conta_receber_parcela cri
left join conta_receber cr on (cr.idconta_receber = cri.idconta_receber)
left join vencimento vp on (vp.idvencimento = cr.idvencimento)
left join cliente cl on (cl.idcliente = cr.idcliente)
left join cheque ch on (ch.idcheque = cri.idcheque)
where (case :ptipodata
             when 0 then ((cri.data_vencimento = ´´) and (cri.data_pagamento 
= ´´))
             when 1 then (cri.data_vencimento between :pdata1 and :pdata2)
             when 2 then (cri.data_pagamento between :pdata1 and :pdata2)
      end
      )



Como posso fazer isso?

Desde já agradeço.

[]s


Titanius

Titanius

Responder

Posts

03/05/2006

Sremulador

que erro esta dando amigo


Responder

Gostei + 0

04/05/2006

Xtreme

select cri.*, vp.qnt_parcela TotalParcela, cl.razao_social NomeCliente, case when cri.tipo_doc = 0 then ´Duplicata´ when cri.tipo_doc = 1 then ´Promissória´ when cri.tipo_doc = 2 then ´Cheque´ when cri.tipo_doc = 3 then ´Cartão´ when cri.tipo_doc = 4 then ´Boleto´ when cri.tipo_doc = 5 then ´Carnê´ when cri.tipo_doc = 6 then ´Dinheiro´ end as DescTipoDoc, (coalesce(cri.valor,0) - coalesce(cri.valor_pago,0)) as ValorAberto, case when cri.status = ´A´ then ´Aberto´ when cri.status = ´F´ then ´Fechada´ when cri.status = ´P´ then ´Parcial´ end as DescStatu from conta_receber_parcela cri left join conta_receber cr on (cr.idconta_receber = cri.idconta_receber) left join vencimento vp on (vp.idvencimento = cr.idvencimento) left join cliente cl on (cl.idcliente = cr.idcliente) left join cheque ch on (ch.idcheque = cri.idcheque) where (case :ptipodata when 0 then ((cri.data_vencimento [b:45a01d3a98]is null[/b:45a01d3a98]) and (cri.data_pagamento [b:45a01d3a98]is null[/b:45a01d3a98])) when 1 then (cri.data_vencimento between :pdata1 and :pdata2) when 2 then (cri.data_pagamento between :pdata1 and :pdata2) end );



Bom ao inves de ´´ acho que ficaria melhor colocar [b:45a01d3a98]is null[/b:45a01d3a98]. Mas nem sei se esse é o erro!


Responder

Gostei + 0

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar