RE: selecting just one row
Posted in 1997
Topics: General Discussion
Hello
I think one solutions:
select customer_code, price from oplist
where product_code = ? and price_list = ? and
(customer_code = ? or customer_code is null') into temp customer_temp;
then if you are priorizing the value of customer_code is null;
select proce from customer_temp where customer_code is null;
or if you priorizing the value not null:
select proce from customer_temp where customer_code is null;
other solutions is a cursor whit the same select you are writing but closing it after the first row
bye.
-----Mensaje original-----
De: Postbox [SMTP:postbox@dial.pipex.com]
Enviado el: Jueves 6 de Noviembre de 1997 16:06
Para: informix-list@rmy.emory.edu
Asunto: selecting just one row
Does anyone no how to select one row from a table based on the first or
part of an or expression ?
Example:
select price from oplist where product_code = ? and price_list = ? and
(customer_code = ? or customer_code is null')
I need to select one row if customer_code is not null or one row if
customer_code is null. Not two rows as is happening due to one row with a
customer_code and another with a null value.
Does anyone have any suggestions?
Regards,
Peter Neville.