Answered by:
RELATORIO EM SQL COM PLANO DE CONTAS

Question
-
Boa tarde galerinha!
Gostaria que me ajudassem a por nesse mesmo relatório a descriçao de um plano de contas.
Fiz de tudo, contudo nada bem sucedido.
Abaixo segue o codigo da sql.
Espero que consigam me ajudar.
select sum(caixa.entrada) as totentrada,
sum(caixa.saida) as totsaida,
cencusto.DESCRICAO,
null as saldo_final,
sum(caixa.entrada) - sum(caixa.saida) as saldo_anterior,
null as data,
null as historico,
null as entrada,
null as saida
from caixa
left join cencusto on (caixa.custo = cencusto.codigo)
where caixa.custo = 1 and
caixa.data <= '09/30/2011'
group by cencusto.descricao
union all
select '',
'',
'',
null,
null,
caixa.data,
caixa.historico,
caixa.entrada,
caixa.saida
from caixa
where caixa.data >= '10/01/2011' and
caixa.data <= '10/31/2011' and
caixa.custo = 1
order by 6Tuesday, December 13, 2011 6:16 PM
Answers
-
English please.
If your column is datetime type use:
caixa.data < '10/01/2011'
where caixa.data >= '10/01/2011' and
caixa.data < '11/01/2011' andArticle:
http://www.sqlusa.com/bestpractices2008/between-dates/
Kalman Toth, SQL Server & Business Intelligence Training; SQL 2008 GRAND SLAM- Marked as answer by Kalman Toth Sunday, December 18, 2011 4:47 PM
Tuesday, December 13, 2011 8:58 PM -
Can you please ask your question in English instead of Portuguese?
Vinay Valeti| If you think my suggestion is useful, please rate it as helpful. If it has helped you to resolve the problem, please Mark it as Answer- Marked as answer by Kalman Toth Sunday, December 18, 2011 4:47 PM
Tuesday, December 13, 2011 9:00 PM
All replies
-
English please.
If your column is datetime type use:
caixa.data < '10/01/2011'
where caixa.data >= '10/01/2011' and
caixa.data < '11/01/2011' andArticle:
http://www.sqlusa.com/bestpractices2008/between-dates/
Kalman Toth, SQL Server & Business Intelligence Training; SQL 2008 GRAND SLAM- Marked as answer by Kalman Toth Sunday, December 18, 2011 4:47 PM
Tuesday, December 13, 2011 8:58 PM -
Can you please ask your question in English instead of Portuguese?
Vinay Valeti| If you think my suggestion is useful, please rate it as helpful. If it has helped you to resolve the problem, please Mark it as Answer- Marked as answer by Kalman Toth Sunday, December 18, 2011 4:47 PM
Tuesday, December 13, 2011 9:00 PM