You can also use 'query' under tools in crx/de to test your sql2.Also as @Scott mentioned, AEM version matters as in AEM 6.0 indexes would not be created and would will have to create the indexes. In AEM 6.x, you can also use Query Manager to evaluate your query.