Subject | IF in a Query |
---|---|
Author | apatri@inwind.it |
Post date | 2001-02-16T14:46:08Z |
Hi List.
Let Me expand my question.
Thanks to Svein I have solved the first problem.
Now pass on:
I must reply this query 5 times.
The only difference is in the WHERE clause:
<< and presenze.statuspresenza = 'Presenza Feriale' >>
It could be : 'Presenza Feriale'
: 'Presenza Festivo'
: 'Presenza Domenicale'
Etc..
There is a way to perform a sort of if?
Eg
Sum this if ACondition
elseif
etc..
This is the Query.
select
presenze.prezzoorariosocio,
sum((cast( presenze.orelavorate as time ) - cast( '0.00.00' as
time ) ) /60/60 ),
sum (presenze.prezzototalesocio)
from presenze where
( presenze.datapresenza between :piniziale and :pfinale)
and presenze.collsocio like :pcollsocio
and presenze.collditta like :pcollditta
and presenze.collfattura like :pcollfattura
and presenze.collpagamento like :pcollpagamento
and presenze.mansione=:vmansione
and presenze.statuspresenza = 'Presenza Feriale'
group by presenze.prezzoorariosocio
into :vporarioferiale, :voreferialec, :vpferiale;
Don't angry with me, Please.
Thanks
Arnaldo
Let Me expand my question.
Thanks to Svein I have solved the first problem.
Now pass on:
I must reply this query 5 times.
The only difference is in the WHERE clause:
<< and presenze.statuspresenza = 'Presenza Feriale' >>
It could be : 'Presenza Feriale'
: 'Presenza Festivo'
: 'Presenza Domenicale'
Etc..
There is a way to perform a sort of if?
Eg
Sum this if ACondition
elseif
etc..
This is the Query.
select
presenze.prezzoorariosocio,
sum((cast( presenze.orelavorate as time ) - cast( '0.00.00' as
time ) ) /60/60 ),
sum (presenze.prezzototalesocio)
from presenze where
( presenze.datapresenza between :piniziale and :pfinale)
and presenze.collsocio like :pcollsocio
and presenze.collditta like :pcollditta
and presenze.collfattura like :pcollfattura
and presenze.collpagamento like :pcollpagamento
and presenze.mansione=:vmansione
and presenze.statuspresenza = 'Presenza Feriale'
group by presenze.prezzoorariosocio
into :vporarioferiale, :voreferialec, :vpferiale;
Don't angry with me, Please.
Thanks
Arnaldo