I am trying to execute below query and getting error which says Unexpected token IN Can someone please help to understand what is wrong here.
String str = 'SELECT Name FROM Account';
String str1='WHERE';
String str3='Name IN (\'test\',\'test9\')';
list<Account> accclist=Database.query(str+str1+str3);
system.debug(accclist);
However when I run this below one it runs perfectly fine.
list<Account> accclist=Database.query('SELECT Name FROM Account WHERE Name IN (\'test\',\'test9\')');