select o.order_num, sum (i.total_price) price, paid_date - order_date span from orders o, items i where o.order_date > "01/01/89" and o.customer_num > 110 and o.order_num = i.order_num group by 1, 3 having count (*) < 5 order by 3 into temp temptab1;