Hi I need help to resolve this SQL Syntax Error. Appreciate anyone can advice as how it can be resolved. Thanks. $sq = "select t2.*,t1.* from (select id,name,points from celebrity order by points desc limit 44 ) t1 inner join photos t2 on t1.id = t2.celebid GROUP BY celebid ORDER BY points desc"; Code (markup): I got this error running the above code: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'select id,name,points from celebrity order by points desc limit Any advice will be greatly appreciated.