Subject | Re: Substraction of 2 selections |
---|---|
Author | Svein Erling |
Post date | 2004-04-30T09:19:09Z |
--- In firebird-support@yahoogroups.com, rpoulin wrote:
select DK1.PRIX_MARGE_DETAIL, DK1.PRINCIPAL from
DETAIL_KIT DK1
where DK1.PRINCIPAL ='O'
and not exists (select * from DETAIL_KIT DK2
where DK2.PRIX_MARGE_DETAIL = DK1.PRIX_MARGE_DETAIL
and DK2.PRINCIPAL ='N')
order by NO_ORDRE
HTH,
Set
> I want to substract those two following selections from my KITSimple, Richard, just do
> 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
>
> THANK ..... a lot ...
> Richard P
select DK1.PRIX_MARGE_DETAIL, DK1.PRINCIPAL from
DETAIL_KIT DK1
where DK1.PRINCIPAL ='O'
and not exists (select * from DETAIL_KIT DK2
where DK2.PRIX_MARGE_DETAIL = DK1.PRIX_MARGE_DETAIL
and DK2.PRINCIPAL ='N')
order by NO_ORDRE
HTH,
Set