Subject | Re: [firebird-support] Substraction of 2 selections |
---|---|
Author | rpoulin |
Post date | 2004-04-30T14:58:44Z |
Thanks again \\
Milan,
Adding the given expression to my table , ie :
ALTER TABLE DETAIL_KIT
ADD DELTAPRIX2 COMPUTED BY (select d1.PRIX_MARGE_DETAIL -
d2.PRIX_MARGE_DETAIL from DETAIL_KIT d1 left join DETAIL_KIT d2 on
d1.no_ordre = d2.no_ordre AND d2.PRINCIPAL ='N' where d1.PRINCIPAL ='O'
order by d1.NO_ORDRE)
i get the folowing error (i am using EMS Interbase/Firebird Manager)
fmCompile.quCompile: Invalid token. Dynamic SQL Error. SQL error code =
-104.
Token unknown - line 2, char 27. select.
----
'Select' is not rekongnise in the computed field expression. !!!!!
Do i need to create a function somwhere ?
(sorry, i am a beginner)
--------------------
Milan Babuskov wrote:
rpoulin wrote:
select d1.PRIX_MARGE_DETAIL - d2.PRIX_MARGE_DETAIL
from DETAIL_KIT d1
left join DETAIL_KIT d2 on d1.no_ordre = d2.no_ordre
AND d2.PRINCIPAL ='N' where d1.PRINCIPAL ='O'
order by d1.NO_ORDRE
HTH
--
Milan Babuskov
http://fbexport.sourceforge.net
-
Milan,
Adding the given expression to my table , ie :
ALTER TABLE DETAIL_KIT
ADD DELTAPRIX2 COMPUTED BY (select d1.PRIX_MARGE_DETAIL -
d2.PRIX_MARGE_DETAIL from DETAIL_KIT d1 left join DETAIL_KIT d2 on
d1.no_ordre = d2.no_ordre AND d2.PRINCIPAL ='N' where d1.PRINCIPAL ='O'
order by d1.NO_ORDRE)
i get the folowing error (i am using EMS Interbase/Firebird Manager)
fmCompile.quCompile: Invalid token. Dynamic SQL Error. SQL error code =
-104.
Token unknown - line 2, char 27. select.
----
'Select' is not rekongnise in the computed field expression. !!!!!
Do i need to create a function somwhere ?
(sorry, i am a beginner)
--------------------
Milan Babuskov wrote:
rpoulin wrote:
> I want to substract those two following selections from my KIT tableTry this:
> and put the result in a new field called DELTAPRICE. Do i need to create
> a function to take care of the script ?
>
> select DETAIL_KIT.PRIX_MARGE_DETAIL, DETAIL_KIT.PRINCIPAL from
> DETAIL_KIT where PRINCIPAL ='O' order by NO_ORDRE
>
> [ minus ]
>
> select DETAIL_KIT.PRIX_MARGE_DETAIL, DETAIL_KIT.PRINCIPAL from
> DETAIL_KIT where PRINCIPAL ='N' order by NO_ORDRE
select d1.PRIX_MARGE_DETAIL - d2.PRIX_MARGE_DETAIL
from DETAIL_KIT d1
left join DETAIL_KIT d2 on d1.no_ordre = d2.no_ordre
AND d2.PRINCIPAL ='N' where d1.PRINCIPAL ='O'
order by d1.NO_ORDRE
HTH
--
Milan Babuskov
http://fbexport.sourceforge.net
-