Assign a single result from a SOQL query into a string variable

 String name = [SELECT Name FROM Account].Name; 

  • Rohith kumar

    Thanks!