Subject | Re: [ib-support] IF in a Query |
---|---|
Author | Svein Erling Tysvær |
Post date | 2001-02-16T15:16:15Z |
Hi again Arnaldo!
I don't think I quite understand your problem, because it sounds as if you
could just use a parameter which you already use other places in the query.
'If' is not supported in SQL. You may be able to do something like it in a
Stored Procedure.
I don't know about the rest of the people of this list, but you're not
making me angry at all.
Set
At 14:46 16.02.2001 -0000, you wrote:
I don't think I quite understand your problem, because it sounds as if you
could just use a parameter which you already use other places in the query.
'If' is not supported in SQL. You may be able to do something like it in a
Stored Procedure.
I don't know about the rest of the people of this list, but you're not
making me angry at all.
Set
At 14:46 16.02.2001 -0000, you wrote:
>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