Fix inner query returning more than one result

On MySQL, only the first table was being exposed in the database object after connecting to the database.

The inner query returned more than one result, causing the external query to return only one table (the first one). The LIMIT 1 fixes this issue.