Re: help request for sql select ahum a bit too cloudy....
if you want to have the max value from a table in your select list you
may want to consider an spl.
quick and dirty....eq:
create procedure mymaxorder_num( f_customer_num like
orders.customer_num)
returning int;
define retval int;
let retval = -1;
select max(order_num) into retval from orders
where customer_num = f_customer_num;
return retval;
end procedure;
select customer_num, lname , mymaxorder_num(customer_num)
from customer
Superboer
if V db >= 9 then replace procedure by function. |