I've written the below trigger but get this error:
Compile Error: line 5:20 no viable alternative at character '"' at line 5 column 20
What's wrong with my code? How can I fix it?
trigger AccountDuplicateTrigger on Account (before insert, before update)
{
for(Account a:Trigger.new)
{
List<Account> acc= "Select id from Account where Name=:a.Name and Rating=:a.Rating";
if(acc.size()>0)
{
acc.Name.addError('You Cannot Create the Duplicate Account');
}
}
}