Select Error: Unknown column 'RN' in 'where clause'