select count(*)
from ec_orders
where order_id=:order_id
select count(*)
from ec_orders
where order_id=:order_id
and user_id=:user_id
select count(*)
from ec_orders
where order_id=:order_id
and order_state='in_basket' and saved_p='t'
select p.product_name, p.one_line_description, p.product_id, i.color_choice, i.size_choice, i.style_choice, count(*) as quantity
from ec_orders o, ec_items i, ec_products p
where i.product_id=p.product_id
and o.order_id=i.order_id
and o.order_id=:order_id
group by p.product_name, p.one_line_description, p.product_id, i.color_choice, i.size_choice, i.style_choice
select count(*)
from ec_orders
where order_state='in_basket'
and user_session_id=:user_session_id
update ec_orders set user_session_id=:user_session_id, saved_p='f' where order_id=:order_id
select o.offer_code, o.product_id
from ec_user_sessions s, ec_user_session_offer_codes o, ec_sale_prices_current p
where p.offer_code=o.offer_code
and s.user_session_id=o.user_session_id
and s.user_id=:user_id
order by p.sale_price
delete from ec_user_session_offer_codes
where user_session_id=:user_session_id
insert into ec_user_session_offer_codes
(user_session_id, product_id, offer_code)
values
(:user_session_id, :temp_pd, :offprod)
select order_id
from ec_orders
where user_session_id=:user_session_id
and order_state='in_basket'
update ec_items set order_id=:current_basket where order_id=:order_id
select o.offer_code, o.product_id
from ec_user_sessions s, ec_user_session_offer_codes o, ec_sale_prices_current p
where p.offer_code=o.offer_code
and s.user_session_id=o.user_session_id
and s.user_id=:user_id
order by p.sale_price
delete from ec_user_session_offer_codes
where user_session_id=:user_session_id
insert into ec_user_session_offer_codes
(user_session_id, product_id, offer_code)
values
(:user_session_id, :temp_pd, :offprod)
select order_id
from ec_orders
where user_session_id=:user_session_id
and order_state='in_basket'
delete from ec_items
where order_id=:current_basket
update ec_items set order_id=:current_basket where order_id=:order_id
select o.offer_code, o.product_id
from ec_user_sessions s, ec_user_session_offer_codes o, ec_sale_prices_current p
where p.offer_code=o.offer_code
and s.user_session_id=o.user_session_id
and s.user_id=:user_id
order by p.sale_price
delete from ec_user_session_offer_codes
where user_session_id=:user_session_id
insert into ec_user_session_offer_codes
(user_session_id, product_id, offer_code)
values
(:user_session_id, :temp_pd, :offprod)
delete from ec_items
where order_id=:order_id
delete from ec_items
where order_id=:order_id