Modify SQL query and add return data