Execute Sql Query in drupal
You should better start debugging the query.Things that might be help you debugging the query.


Install devel module. Having logged in as admin visit "yoursitename.com/devel/php" here you can execute any php code.
Put your query there and add this dpm($result); single line of code in the last of query. Execute the query, see what you get as result.
If the query execution is throwing error visit "yoursitename/admin/reports/dblog" and try to figure out the reason for the error.


You can also cross check if the query returned with drupal wrapper functions is same as your original query by stringyfying the query object, to do that add 

`dpm((string) $query);`


just before $result = $query->execute(); and also remember to comment $result = $query->execute(); as execution of query may cause error in your case.