• As the queries are the same barring the test for pord_pondcode the below would eb more efficient than two queries.

    Also you were grouping by plsup_minord but not selecting it out.

    select case when pord_pondcode = 'Local' then 'Local' else 'Non-Local' end,sum(poit_valord),poit_supplier

    from poitem,porder,plsupp

    where poit_order = pord_order

    AND poit_qtydel < poit_qtyord

    AND pord_supplier = poit_supplier

    AND plsup_ndcode = pord_supndcode

    GROUP BY poit_supplier,plsup_minord,case when pord_pondcode = 'Local' then 'Local' else 'Non-Local' end



    Clear Sky SQL
    My Blog[/url]