Can't perform query on database Error: Unknown column 'R1' in 'where clause'