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 (7925,4547,7922,7924,8105,1846,7647,8014,8013,7540,7539,5707,4230,1605,1654,1657,1661,1662,1664,1665,1666,1667,1668,1669,1670,1672,1673,1674,1675,1676,1679,1685,1686,1691,1847,1848,1849,1851,1852,1860,1861,1864,1866,1867,1868,1869,1870,1871,1872,1873,1874,1875,1876,1878,1879,1880,1881,1882,1883,1885,1886,1887,2056,2057,2081,3334,3335,3336,3407,7638,3466,3468,3497,3499,3500,3501,3502,3507,3508,3509,3510,3513,3515,3516,3517,3518,3519,3521,3522,3523,3524,3525,3526,3527,3528,3531,3543,3547,3548,3549,3550,3553,3554,3555,3556,3557,3558,3559,3560,3561,3562,3563,3574,3575,3577,4211,4212,4213,4214,4215,4220,4223,4232,4233,4234,4235,4236,4237,4238,4239,4240,4249,4250,4354,4355,4358,4361,4362,4366,4548,7856,7690,4559,4769,4770,4771,4772,4773,4776,4780,4781,4784,4785,4786,4787,4788,4789,4790,4791,4792,4793,4794,4796,4797,4798,4803,4804,4889,4890,4891,4892,4893,4894,4895,4896,4897,4898,4899,4900,4901,4902,4903,4904,4907,4908,4909,4910,4911,4912,4913,4914,4915,4916,4917,4918,4919,4920,4921,4922,4923,4924,4925,4926,4927,4928,4929,4930,4931,4936,4938,4939,4940,4941,4942,4943,4944,4945,4946,4947,4948,4949,4950,4951,4952,4953,4954,4958,4959,4960,4961,4962,4963,4964,4965,4966,4967,4968,4969,4970,4971,4972,4973,4974,4975,4977,4979,4980,4981,4982,4983,4985,4986,4987,4988,4989,4990,4991,4992,4993,4994,4995,4996,4997,4998,4999,5000,5001,5002,5004,5005,5006,5007,5008,5009,5010,5026,5027,5028,5029,5030,5031,5032,5033,5035,5036,5037,5038,5039,5040,5041,5042,5043,5044,5045,5046,5047,5048,5049,5050,5051,5052,5053,5055,5065,5066,5067,5068,5093,5389,5392,5394,5668,5684,5687,5708,5709,5712,5713,5714,5738,5739,5740,5741,5742,5949,5950,5974,5975,5976,5977,6031,5978,5979,5980,5981,5982,6046,6047,6068,6069,6070,6071,6072,6073,6074,6075,6076,6077,6078,6079,6085,6086,6087,6088,6089,6090,6100,6101,6102,6129,6130,6131,6132,6133,6134,6135,6136,6137,6138,6139,6154,6157,6319,6321,6322,6323,6348,6351,6352,6353,6389,6595,6633,7202,7203,7204,7205,7206,7207,7208,7209,7210,7211,7212,7213,7215,7216,7217,7218,7220,7222,7233,7234,7235,7236,7237,7238,7239,7240,7241,7242,7243,7244,7245,7246,7247,7258,7259,7260,7261,7262,7337,7327,7340,7341,7445,7446,7483,7518,7536,7541,7544,7591,7592,7610,7611,7612,7613,7614,7643,7926,7653,7655,7656,7657,7658,7659,7660,7661,7662,7663,7664,7665,7666,7667,8106,7670,7669,7671,7695,7696,7697,7698,7705,7724,7754,7755,7762,7763,7764,7765,7766,7767,7768,7769,7770,7771,7777,7778,7779,7780,7781,7783,7784,7792,7823,7826,7887,7891,7913,7914,7915,7927,7928,7929,7930,7931,7932,7970,7971,7972,7973,8015,8016,8017,8018,8023,8052,8062,8065,8083,8107,8108)
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 = 7 OR cat_madre = 7) AND pro_stato <= 7 AND cat_stato >= 1 AND sku_stato = 1
GROUP BY pro_id