×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: SQL
Posted by: Roman Ignatov
Added: Nov 22, 2016 4:22 PM
Views: 10
Tags: magento
  1. DELETE FROM sales_flat_quote
  2. WHERE is_active = 0
  3.       OR updated_at < DATE_SUB(NOW(), INTERVAL 365 DAY)
  4.       OR items_qty < 1;
  5.  
  6.  
  7. DELETE FROM sales_flat_quote
  8. WHERE updated_at < DATE_SUB(NOW(), INTERVAL 90 DAY)
  9.       AND entity_id NOT IN (SELECT quote_id
  10.                             FROM product_ticket_calendar_sold
  11.                             WHERE quote_id > 0);