select count(*) from ec_items where order_id=:order_id and product_id=:product_id and item_state <> 'void' select count(*) from ec_items where order_id=:order_id and product_id=:product_id select item_state from ec_items where order_id=:order_id and product_id=:product_id select count(*) from ec_items where order_id=:order_id and product_id=:product_id and item_state in ('shipped','arrived','received_back') select i.item_id, i.item_state, p.product_name, i.price_name, i.price_charged from ec_items i, ec_products p where i.product_id=p.product_id and i.order_id=:order_id and i.product_id=:product_id