SELECT pro_id, pro_nome, pro_ordine, pro_stato, MIN(sku_vendita) AS min, MAX(sku_vendita) as MAX, (sku_listino - sku_vendita) AS diff , url_seo
FROM catalogo_prodotti
LEFT JOIN catalogo_sku ON pro_id = sku_prodotto
LEFT JOIN catalogo_categorie ON pro_categoria = cat_id
LEFT JOIN pagine_url ON pro_id = url_rif
WHERE pro_id IN (102,5678,115,117,118,119,132,134,138,142,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,178,179,221,7639,4521,4520,4519,4518,1168,1175,1187,7251,7387,7386,2050,7838,7839,2261,2392,3338,3337,2393,2394,2411,2412,2415,2416,2417,2420,2421,2422,2423,2424,2426,2427,2429,2430,2432,2435,2437,2438,2439,2462,3191,3192,3193,3194,3195,3196,3203,3204,3207,3237,3238,3320,7256,3711,3721,3785,3786,4067,4119,4360,4369,4371,5419,5426,5429,5430,5442,5495,5614,5618,114,5761,5762,5848,5890,5931,5933,5934,5935,5936,5937,5938,5939,5940,5941,5944,5946,5947,5948,6049,6313,6315,6670,6671,6935,7049,7050,7051,7053,7055,7169,7252,7253,7254,7714,7328,7339,7400,7401,7442,7519,7520,7521,7522,7523,7524,7535,7589,7590,7848,8853,7849,7920,7708,7788,7806,7857,7872,7874,7916,7918,7919,8024,8025,8085,8092,8100,8256,8257,8258,8259,8260,8370,8371,8372,8373,8374,8376,8380,8381,8382,8383,8384,8385,8386,8387,8388,8389,8390,8391,8392,8393,8394,8395,8396,8398,8399,8400,8401,8402,8403,8404,8405,8406,8407,8408,8771,8854,8921,8932,8983,9062,9066)
GROUP BY pro_id
ORDER BY pro_stato ASC, pro_ordine DESC, pro_nome ASC
LIMIT 0,12
SELECT pro_id AS proid
FROM catalogo_prodotti
LEFT JOIN catalogo_sku ON pro_id = sku_prodotto
LEFT JOIN catalogo_categorie ON pro_categoria = cat_id
LEFT JOIN pagine_url ON pro_id = url_rif
WHERE (cat_id = 2 OR cat_madre = 2) AND pro_stato <= 7 AND cat_stato >= 1 AND sku_stato = 1
GROUP BY pro_id