SQL question

From: Henrik Staun Poulsen <hsp_at_infolog.dk>
Date: 1998/09/09
Message-ID: <35F67CCD.5104D35F_at_infolog.dk>#1/1


[Quoted] Dear All,

[Quoted] [Quoted] I want to select the sum of all orders, but I want to subtract the all [Quoted] the sale reversals, i.e. all orders that where canceled out. Do I need to create a union like

create view test as
  select sum(amount) 'TotalO' from order where Type = 'S'   UNION
  select (sum(amount) * (-1)) 'TotalO' from order where Type = 'R'

select TotalO from test

OR is there a way of writing the select statement with an IF statement or a CASE statement?

TIA Henrik Staun Poulsen
InfoLog Received on Wed Sep 09 1998 - 00:00:00 CEST

Original text of this message