Sql optimise category edit options branch2

## Testing Instructions:
In order to test this PR first apply the PR via the joomla Patch Test. Then log in to the admin panel and click on the add new article. After clicking on the add new article, the query executes.
![Add New Article](https://cloud.githubusercontent.com/assets/1329674/3895200/d14f9d8e-224b-11e4-9a13-d83208ea42d5.PNG)

### Original Query before the Optimization
```sql
     SELECT a.id AS value, a.title AS text, a.level, a.published 
     FROM #_categories AS a 
     LEFT JOIN #_categories AS b 
     ON a.lft > b.lft 
     AND a.rgt < b.rgt 
     WHERE (a.extension = 'com_content') 
     AND a.published IN (0,1) 
     GROUP BY a.id, a.title, a.level, a.lft, a.rgt, a.extension, a.parent_id, a.published 
     ORDER BY a.lft ASC
```
### After the Optimization
```sql
     SELECT DISTINCT c.id AS value, c.title AS text, c.level, c.published
      FROM (
                  SELECT DISTINCT id,title,level,published,parent_id,extension,lft,rgt 
                   FROM #_categories
                   WHERE  (extension = 'com_content') AND published IN (0,1)
                   ORDER BY lft ASC
                   ) AS c
      LEFT JOIN #_categories AS b
      ON x.lft > b.lft
      AND x.rgt < b.rgt
```
### Query Change Description
In the new query the change is the new sub select. In the previous query the tables are being joined and in the new query as you can see in the red color query is the sub select. In the sub select it filters the rows according to the `WHERE` clause of the previous query. As you can see this filters the rows and reduce the number of rows before the join and which results a fever number of rows to choose the attributes.Also Removed the group by clause and added the `SELECT DISTINCT` instead


http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=34066
Fixed the spaces