postgresql7.1
select ec_products.product_id, ec_products.price, ec_category_product_map.category_id, min(sale_price) as sale_price from acs_objects, ec_products left join ec_category_product_map on ec_category_product_map.product_id=ec_products.product_id left join ec_sale_prices_current on ec_sale_prices_current.product_id=ec_products.product_id where acs_objects.context_id=:event_id and acs_objects.object_id=ec_products.product_id group by ec_products.product_id, ec_products.price, ec_category_product_map.category_id
select ec_products.product_id from acs_objects, ec_products left join ec_category_product_map on ec_category_product_map.product_id=ec_products.product_id where acs_objects.context_id=:event_id and acs_objects.object_id=ec_products.product_id
update ec_products
set product_name='$activity_info(name) $date_time',
sku='event_$event_id',
one_line_description='$activity_info(name); $date_time; $pretty_location',
detailed_description='$activity_info(description)',
email_on_purchase_list=:email,
search_keywords='$activity_info(name), $venue_info(venue_name), $pretty_location',
url='$activity_info(detail_url)',
price=:event_price,
no_shipping_avail_p='t',
present_p='$event_info(available_p)',
available_date=now(),
$audit_update
where product_id=:product_id
last_modified=current_timestamp, last_modifying_user=:user_id, modified_ip_address=:peeraddr
insert into ec_category_product_map values (:product_id, :category_id, null, current_timestamp, :user_id, :peeraddr)
select ec_product__new(
null,
:user_id,
:event_id,
'$activity_info(name) $date_time',
:event_price,
'event_$event_id',
'$activity_info(name); $date_time; $pretty_location',
'$activity_info(description)',
'$activity_info(name), $venue_info(venue_name), $pretty_location',
't',
'i',
null,
to_date(current_timestamp, 'YYYY-MM-DD'),
null,
null,
:peeraddr
)
select ec_product__delete(:product_id)