Re: Minus function in Informix/SQL - How?
Posted in 1995
In article <412l98$cfm@news.informix.com>,
Dennis Pimple <dennisp@informix.com> wrote:
>Anish Maharaj (anish@cs.uct.ac.za) wrote:
>: Hello,
>
>: I am using Informix-SQL to perform some benchmarks. I need to use a
>: minus function but it appears that there is no standard minus function
>: available in Informix. (i.e. a function to subtract one relation from
>: another R1-R2).
>
>I was just successfully able to do this:
>
>SELECT cola - colb FROM table
>
>[...]
>
>Unless I don't know what you mean by a "minus function", this should
>work.
I suspect that what Anish is thinking of is something along these lines:
select product_num, product_type
from inventory
MINUS
select product_num, product_type
from orders
(i.e. show me all the <product_num, product_type> combinations that appear
in the inventory table but don't appear in the orders table). I think that
it isn't ASNI standard but it is part of Horracle's SQL*Plus. You can do
the same thing with correlated subqueries I belive, details are left as an
exercise for the reader (i.e. I know you can do it but I forget exactly how
it goes).
- Paul
** not a spokesman, etc **