postgresql 7.1 select 1 where exists (select 1 from ec_orders where user_id=:user_id and order_state = 'in_basket' and saved_p='t')