ERROR WITH A QUERY " SELECT pictures.*, categories.title as category_title, categories.status as category_status FROM pictures LEFT JOIN categories ON categories.id = pictures.category_id WHERE pictures.ped_type ='1' AND (pictures.status in ) AND pictures.category_id = '2579' AND pictures.gallery_id in (27,39,40,41,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,176,242,245,254,263,264,278,279,300,301,302,303,304,307,308,311,312,315,316,317,320,322,326,329,330,331,332,333,334,335,337,338,339,340,341,342,344,348,349,351,352,354,356,362,365,368,370,371,372,373,374,377,379,380,382,384,388,389,390,395,397,399,400,402,404,405,406,408,414,415,417,418,419,420,423,425,426,427,429,430,431,433,434,437,438,440,444,445,446,447,448,450,453,456,458,459,460,462,463,466,468,469,470,471,472,473,474,476,478,479,480,485,493,496,499,500,506,512,519,520,521,522,523,524,525,530,532,534,540,541,545,548,549,552,558,564,565,566,568,575,580,582,584,586,595,614,619,620,640,647,651,653,664,665,675,676,686,694,703,741,1448,1643,1644,1645,1646,1648,1649,1650,1651,2274,2281,2292,2306,2316,2326,451257,451534,453513,454221,454573,454787,455775,455777,473815,477517,477564,477571,477601,483018,483866,521250,541234,544691,544699,547022,549936,551769,553388,553645,554305,554722,555234,556043,556665,558098,558506,559570,559958,562787,564533,565586,566149,566173,567196,571858,572336,572446,572651,573519,574171,574632,574858,575425,575701,576114,576709,577794,578893,578970,578991,579050,579149,579412,579433,581401,581533,582350,583612,583621,583770,584384,585895,587474,587918,589750,589772,590380,590727,591302,591313,591460,594615,594827,595270,595928,597035,597963,598172,598430,598843,600445,600565,601067,601099,601105,601878,602258,604070,604397,604603,604942,607256,607798,608461,608767,609554,609626,610608,611584,613195,614230,614342,617756,618272,618423,618531,619395,619407,619433,620399,620930,621168,621865,622190,622314,622328,622430,625000,625003,625532,626915,626950,626969,627020,629172,631089,631534,631694,631832,631843,631845,632186,632212,632678,632937,632998,633634,633721,633749,633854,634241,634927,634991,635288,635309,635798,636023,636479,636560,636613,636816,636878,636962,637721,638026,638490,638583,639078,639493,639999,640352,640394,640908,641596,641998,643496,643690,644039,645173,645889,645906,647115,647930,647985,648957,649040,649078,649098,649464,650647,650911,651250,651360,651485,654319,655724,658293,658360,658809,659319,662033,663253,664072,665498,666731,667085,667488,669279,670258,671533,672334,672663,672699,673062,673332,673348,673359,673429,674020,674370,674637,674886,676314,676625,676966,677023,677590,680418,681192,683893,684530,684812,687232,688263,688942,690780,692237,692247,693086,693884,693974,694295,694333,694556,694738,694900,695233,695359,695412,696722,696731,699640,699810,700051,700726,702031,703482,703721,709107,709348,711437,711994,712955,714474,714932,717194,719527,719617,722823,723509,723533,724719,724836,724837,725447,732577,735233,737515,738225,740413,742511,743497,743639,744889,744924,749069,749678,749686,750666,752655,754582,755096,758159,758945,759201,760706,761062,761072,761073,761159,761449,761980,762528,763216,763466,765255,766288,766698,766716,768801,770891,771386,774809,774823,774966,777400,779551,779964,781116,781146,781912,782650,782681,782926,783002,783162,786683,787773,791804,794242,797876,797990,798185,798665,799633,800727,801714,803025,806308,806375,808265,808726,809261,811255,811814,813535,821918,823387,828993,829494,830742,830784,832329,835325,844789,844986,845975,846320,847742,847845,847868,848469,848685,850456,854794,857451,859688,861888,865438,865839,868912,869035,871954,872203,872922,873945,882088,883269,885343,888331,892469,893345,895301,898878,899430,899433,900230,901356,903855,907538,909235,910898,914346,914416,919572,921794,924632,924718,925192,928116,930438,930537,932595,934038,942924,944554,948388,949093,951844,952349,952354,952356,952362,952363,952532,952958,953234,954127,955847,956258,956859,957444,958785,958872,959454,961093,961658,963804,963907,964400,964767,965406,967198,967201,967202,971367,971743,975223,980314,980449,981807,981999,984065,985554,985629,985843,987298,988855,995340,997072,997991,999885,1000018,1001239,1004721,1005002,1008518,1011893,1011897,1020348,1021989,1025925,1026239,1029092,1029544,1030558,1032726,1032841,1037533,1038168,1041253,1042221,1048378,1050794,1054159,1061062,1063461,1064866,1067586,1067727,1069490,1077925,1087475,1097736,1098777,1099713,1100142,1105740,1106002,1108903,1108998,1110146,1110340,1110378,1111331,1111642,1112046,1124617,1125686,1125773,1130315,1130479,1133980,1139278,1139854,1139941,1140048,1140805,1143136,1151317,1152214,1152671,1152905,1154735,1157038,1157704,1162838,1166438,1168345,1168543,1170559,1172605,1175129,1176564,1180351,1181196,1183098,1187020,1193947,1196148,1198791,1201041,1204608,1205004,1206560,1207540,1209325,1213072,1215061,1215062,1215063,1215064,1215065,1215066,1215067,1215796,1215798,1215799,1215800,1215801,1215802,1215803,1215804,1215805,1215807,1215809,1215811,1215812,1215818,1216113,1216118) ORDER by pictures.added DESC LIMIT 1 "