I would be tempted to go with something along the lines of:
to generate the listCode:SELECT ordered_item FROM (SELECT ordered_item, count(*) FROM orders WHERE order_no IN (SELECT order_no FROM orders WHERE ordered_item IN (list_from_current_order) and ordered_item NOT IN (list_from_current_order) GROUP BY ordered_item ORDER BY count(*) DESC) WHERE rownum < however_many_you_want_to_show
John




Reply With Quote