#!/bin/sh for i in `seq 0 $1` do mysql -u root pstest << EOF & CREATE TEMPORARY TABLE ps_cat_restriction ENGINE=MEMORY SELECT DISTINCT cp.id_product, p.id_manufacturer, product_shop.condition, p.weight FROM ps_category_product cp INNER JOIN ps_category c ON (c.id_category = cp.id_category AND c.nleft >= 78 AND c.nright <= 141 AND c.active = 1) INNER JOIN ps_product_shop product_shop ON (product_shop.id_product = cp.id_product AND product_shop.id_shop = 1) INNER JOIN ps_product p ON (p.id_product=cp.id_product) WHERE product_shop.active = 1 AND product_shop.visibility IN ("both", "catalog"); EOF done wait