select count(*) from ec_orders o, ec_items i where o.order_id=i.order_id and o.user_session_id=:user_session_id and o.order_state='in_basket' select tax_rate, initcap(state_name) as state from ec_sales_tax_by_state tax, us_states state where state.abbrev = tax.usps_abbrev