Subject Re: [firebird-support] Subquery in case statement
Author Alan.Davies@aldis-systems.co.uk
Miel, not sure what you're trying to get here, but you need to place
brackets around the subquery. Try this
when
((select TABLE_VACCPROT.Vacc_1_EH
from TABLE_VACCPROT
where TABLE_VACCPROT.ProtocolID = TABLE_VACC.VaccProtocol) = 'd')
then
DATEADD(day)
end,
... on to your next selects

--
Alan J Davies
Aldis


Quoting mielhostens <mielhostens@...>:

>
> Hi folks,
>
> I am converting a database for the moment from mysql to firebird 2.0,
> encountering following problem with subquery in case statement,
>
> case
>
> when
>
> ((select TABLE_VACCPROT.Vacc_1_EH from TABLE_VACC, TABLE_VACCPROT where
> (TABLE_VACCPROT.ProtocolID = TABLE_VACC.VaccProtocol) = 'd')
>
> then
>
> DATEADD(
>
> day,
>
> (select VACC_1_INT from TABLE_VACCPROT where
> TABLE_VACCPROT.ProtocolID = TABLE_VACC.VACCPROTOCOL),
>
> (select birthday from TABLE_COWS where
> TABLE_COWS.cowregnumber = TABLE_VACC.CowRegNumber )
>
> )
>
> End
>
> Error: invalid token...
>
> i read that the subquery has to result in a boolean, right/wrong?
>
> Suggestions?
>
> Many thanx in advance,
>
> Miel
>
>
>
> [Non-text portions of this message have been removed]
>
>