Select orditems.order_id, Min(Orditems.Product_id) As Product_id ; From OrdItems ; Group by 1 ; Order By 1 ; Into Cursor OI_1 Nofilter Select orders.Order_id, Padr(orders.to_name, 30) As to_name , OI_1.Product_id ; From Orders, OI_1 ; Where orders.order_id = OI_1.order_id ; Union All ; Select orders.Order_id, Space(30), OrdItems.Product_id ; From Orders, orditems ; Where orders.order_id = orditems.order_id ; And Not Exists ( ; Select * ; From OI_1 ; Where OI_1.order_id = orditems.order_id ; And OI_1.product_id = OrdItems.Product_id ) ; Order By 1 ; Into Cursor cc2