select order_id, confirmed_date
from ec_orders
where user_id=:user_id
and order_state not in ('in_basket','void','expired')
order by order_id
select gift_certificate_id, issue_date, amount
from ec_gift_certificates
where purchased_by=:user_id
and gift_certificate_state in ('authorized', 'confirmed')
select ml.category_id, c.category_name, ml.subcategory_id, s.subcategory_name, ml.subsubcategory_id, ss.subsubcategory_name
from ec_cat_mailing_lists ml
left join ec_categories c using(category_id)
left join ec_subcategories s using (subcategory_id)
left join ec_subsubcategories ss on (ml.subsubcategory_id = ss.subsubcategory_id)
where ml.user_id = :user_id