SELECT a.adid, a.adtitle, a.thumbfile, pics.picfile, UNIX_TIMESTAMP(a.createdon) AS timestamp, scat.subcatname, loc.locationslug FROM xzclf_ads a INNER JOIN xzclf_subcats scat ON a.subcatid = scat.subcatid INNER JOIN xzclf_adpics pics ON a.adid = pics.adid LEFT JOIN xzclf_location loc ON (LOWER(a.area) = LOWER(loc.locationname) AND loc.stateid = a.cityid) WHERE a.adid IN (10024247,10024241,10024238,10024232,10024229,10024226,10024220,10024217,10024214,10024208,10024205,10024199,10024196,10024190,10024187,10024184,10024178,10024175,10024169,9989361,9968371,9900323,9896204,9894549,9890671,9882127,9882104,9882075,9881968,9881580,9881494,9726448,9718143,9718140,9718077,9714309,9714205,9711784,9705872,9703740,9695990,9692831,9692810,9692729,9692726,9692723,9692720,9692717,9692711,9692708,9692705,9692702,9692699,9692696,9692693,9692687,9692678,9692675,9686308,9678141,9678138,9678135,9678132,9678129,9678120,9678117,9678114,9678111,9678105,9678102,9677184,9660273,9608371,9608369,9604840,9598303,9581220,9474750,9474747,9416659,9410617,9410468,9410345,9408881,9151929,9151927,9151925,9151923,9151920,9151917,9151864,9151841,9151802,9151765,9151695,9151671,9151504,9104090,9103731,9103337) GROUP BY a.adid LIMIT 30