Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
galwacco
Starting Member
1 Post |
Posted - 2005-10-31 : 05:58:42
|
| Hi everybody!!I have this SQL: SELECT distinct lc.data, SUM(lc.valor), lc.nome_lancamento_padrao FROM lancamentos_financeiros lc INNER JOIN plano_contas pcc ON (pcc.cod_plano = lc.cod_plano_credito) INNER JOIN plano_contas pcd ON (pcd.cod_plano = lc.cod_plano_debito) WHERE (lc.cod_empresa = 1) AND ((lc.id_credito LIKE '1.1.1.1.2.' || '%') OR (lc.id_debito LIKE '1.1.1.1.2.' || '%')) AND(lc.data BETWEEN '2005-01-01' AND '2005-12-31') AND lc.nome_lancamento_padrao IN('Sobra de caixa', 'Contra-vale emitido', 'Venda de mercadorias', 'Cheque pré-datado', 'Dinheiro', 'Ticket')GROUP BY lc.nome_lancamento_padrao, lc.data Which will return the value, date and name from all those three items that are with the IN clause.The problem is that those thress Items come from parameters in my code (which is Delphi), so far so good. The real problem is that I have this list that I built in a form, and from that list of items I get only 3 of them (like you can see in the SQL synthax) and I need to get the left over Items and make it another resulting field like a "OTHERS" field.Would there be a way of doing it using only the SQL synthax or will I have to implement that in my coding program?? If there is a way, how would that be?Thanks for the useful help extended to me since then!!Claudio Fernando Maciel |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|
|
|