change sql query for data method