Subject | Re: [firebird-support] Substraction of 2 selections |
---|---|
Author | rpoulin |
Post date | 2004-04-30T14:33:57Z |
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:
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 table
> > 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
>
> Try this:
>
> 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
>
>
>
> ------------------------------------------------------------------------
> *Yahoo! Groups Links*
>
> * To visit your group on the web, go to:
> http://groups.yahoo.com/group/firebird-support/
>
> * To unsubscribe from this group, send an email to:
> firebird-support-unsubscribe@yahoogroups.com
> <mailto:firebird-support-unsubscribe@yahoogroups.com?subject=Unsubscribe>
>
> * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service <http://docs.yahoo.com/info/terms/>.
>
>