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 (8026,2527,211,212,213,214,216,217,228,230,233,234,236,237,239,240,241,247,249,250,251,252,253,254,256,260,262,264,267,270,277,278,279,289,290,291,292,293,294,295,296,297,298,301,302,306,307,308,309,312,313,314,316,318,319,320,321,322,323,327,339,341,342,343,344,345,346,349,350,351,352,353,354,355,5529,460,461,462,463,464,465,466,467,468,469,470,471,511,513,514,7861,4534,4533,4373,1215,1216,1217,1218,1219,1220,1223,1224,3876,1388,1389,1391,1392,1393,1715,12,3321,2048,2065,2067,2068,2072,2074,2077,2084,2086,2087,2126,7370,2526,2952,3173,3174,3175,8027,8028,3339,3340,3341,3342,3343,3344,3345,3346,3347,3348,3350,3351,3353,3356,3357,3358,3359,3360,3362,3363,3365,3368,3372,3375,3376,3377,3378,3383,3389,3390,3392,3394,3395,3399,3400,3809,5991,3877,3878,3879,3880,3883,3886,3887,3888,3889,3890,3892,3893,3894,3896,3897,3898,3899,3900,3901,3902,3906,3908,3909,3910,3913,3914,3915,3920,3921,3925,3928,3929,3932,3934,3935,3937,3938,3940,3941,3942,3949,3950,3951,3954,3955,3957,3959,3962,3963,3964,3971,3974,4027,4036,4038,4042,4043,4048,4049,4060,4068,4071,4072,4074,4075,4102,4104,4252,4253,4258,4260,4261,4265,4268,4535,4536,4537,4538,4539,4540,5098,5099,5101,5112,5116,5120,5121,5122,5123,5125,5140,5145,5155,5164,5168,5169,5193,5194,5197,5198,5201,5204,5205,5208,5218,5219,5221,5223,5237,5246,5248,5254,5438,5440,5533,5534,5536,5557,5560,8850,8849,5566,5568,8852,8851,5586,5587,5588,5589,5590,5591,5592,5596,5597,5599,5617,5747,5748,5749,5876,5966,9019,5992,5995,6013,6019,6033,6034,6036,6127,6128,6155,6156,6162,6164,6165,6166,6167,8144,6528,6529,6530,6531,6891,7120,7172,7178,7179,7482,7594,7369,7365,7371,7552,7553,7554,7555,7556,7578,7579,7580,7584,7585,7587,7588,7699,7710,7711,7712,7713,7865,7866,8216,7900,7903,7904,7905,7906,7912,8116,8117,8118,8184,8185,8186,8242,8243,8244,8245,8246,8247,8248,8249,8250,8251,8252,8253,8254,8255,8320,8321,8327,8328,8329,8330,8331,8332,8333,8334,8335,8336,8337,8338,8339,8340,8341,8342,8343,8344,8345,8346,8347,8348,8352,8353,8354,8355,8356,8357,8358,8364,8365,8366,8367,8409,8536,8537,8538,8539,8540,8541,8847,8848,8887,8888,8889,8890,8891,8892,8893,8952)
GROUP BY pro_id
ORDER BY pro_stato ASC, pro_ordine DESC, pro_nome ASC
LIMIT -24,24
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 = 6 OR cat_madre = 6) AND pro_stato <= 7 AND cat_stato >= 1 AND sku_stato = 1
GROUP BY pro_id