Fixed a bug in a query
Merge branch 'milestone5' of github.com:WSO2Mobile/mdm into milestone5