updating SQL SELECT QUERY.

Signed-off-by: Gnanakeethan Balasubramaniam <gnanakeethan@gmail.com>