Subject | Re: [firebird-support] Substraction of 2 selections |
---|---|
Author | Milan Babuskov |
Post date | 2004-04-30T14:09:03Z |
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
> 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