Q:

Can't figure out the error in the mysql query

I am trying for an hour now but I am still not able to figure out what's the problem in this query. :/
SELECT * FROM question ORDER BY question_id DESC LIMIT 3 WHERE topic_name = (SELECT * FROM topic WHERE subject_name = 'Maths')

This is the error:

1064 - 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 'WHERE topic_name = (SELECT * FROM topic WHERE subject_name =
  'Maths')' at line 1

A:

Your statements are all out of order.  The correct statement is:
SELECT *
FROM question
WHERE topic_name = (SELECT * FROM topic WHERE subject_name = 'Maths')
ORDER BY question_id DESC LIMIT 3 ;

However, that won't work because of the subquery.  Perhaps you mean something like:
SELECT *
FROM question
WHERE topic_name in (SELECT topic_name FROM topic WHERE subject_name = 'Maths')
ORDER BY question_id DESC LIMIT 3 ;

