Select mb.hudsovet_id,mb.hudsovet_title ,mb.description,mb.member_id,mb.tag,date_format(mb.added_date,'%d.%m.%y %H:%i') AS HudDate, mb.totComment AS blogCmdCnt FROM `member_hudsovet` mb, all_comment mbr WHERE mb.hudsovet_id = mbr.blog_id AND mbr.cat_name='huds' WHERE find_in_set(mb.hudsovet_id,'320,323,334,342,346,347,354,356,357,366,371,372,376,377,386,389,395,402,403,404,405,406,407,408,413,414,415,416,417,418,419,420,421,435,443,445,446,449,451,456,457,460,464,465,470,471,472,477,478,480,481,486,490,498,501,502,508,514,515,516,517,519,523,526,542,543,544,553,554,556,557,560,561,563,566,567,569,575,576,579,580,584,586,595,598,599,600,606,614,618,621,626,628,629,633,647,648,649,650,651,654,661,667,669,671,672,675,676,677,678,680,690,692,696,697,702,717,719,721,735,740,745,746,747,761,769,786,787,788,789,791,794,801,802,804,805,807,811,817,831,832,834,835,836,842,845,847,848,850,853,918,919,920,924,927,928,931,932,944,947,950,964,965,966,967,968,969,970,987,995,1008,1009,1013,1017,1019,1020,1022,1030,1031,1034,1038,1042,1044,1047,1050,1055,1057,1061,1066,1070,1071,1075,1076,1077,1078,1083,1090,1091,1092,1093,1094,1095,1098,1099,1100,1101,1102,1105,1110,1111,1112,1118,1123,1130,1131,1145,1234,1273,1288,1301,1313,1318,1319') AND date_format(mbr.comment_date, '%Y-%m-%d') BETWEEN '2024-03-22' AND '2024-03-28' GROUP BY mb.hudsovet_id ORDER BY blogCmdCnt DESC 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WHERE find_in_set(mb.hudsovet_id,'320,323,334,342,346,347,354,356,357,366,371,37' at line 1