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,'321,322,324,325,328,329,330,331,333,335,337,338,339,340,344,345,348,349,350,355,362,364,365,368,369,373,374,375,378,379,380,382,384,387,390,391,392,393,394,396,397,398,409,410,412,422,424,426,427,430,431,432,434,447,448,450,453,454,455,461,462,463,466,467,468,469,473,474,475,479,483,485,487,488,489,491,492,493,494,495,499,500,504,505,509,510,511,512,513,518,520,521,527,530,531,532,538,539,540,541,550,551,552,558,559,564,568,570,574,577,582,585,593,594,596,601,602,603,605,607,608,609,612,616,625,631,632,634,635,636,637,640,642,643,645,646,652,653,656,658,659,660,662,663,665,666,668,673,674,682,683,684,686,687,698,699,700,701,703,705,706,708,709,712,713,714,715,718,720,722,723,724,727,730,731,732,736,738,739,741,742,743,751,752,754,756,757,758,762,770,771,772,773,774,775,777,778,781,784,792,793,795,796,799,803,806,808,809,815,816,818,819,820,821,822,823,824,825,826,827,828,830,833,837,838,840,841,843,844,846,849,851,855,921,922,926,929,930,934,935,937,939,940,942,945,948,951,952,953,954,955,956,957,958,959,960,961,962,963,972,973,974,975,979,981,982,983,984,985,986,988,989,990,992,993,994,996,1011,1012,1014,1015,1016,1018,1036,1052,1053,1063,1064,1067,1068,1069,1073,1079,1080,1081,1082,1084,1085,1086,1087,1088,1089,1096,1097,1103,1104,1106,1108,1109,1113,1114,1115,1117,1119,1120,1121,1122,1124,1125,1127,1128,1134,1135,1138,1139,1140,1143,1144,1184,1214,1233,1320,1322,1323') AND date_format(mbr.comment_date, '%Y-%m-%d') BETWEEN '2024-03-23' AND '2024-03-29' 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,'321,322,324,325,328,329,330,331,333,335,337,33' at line 1