function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sai manojsai manoj 

Developer Beginner==>Apex Basics & Database Write SOQL Queries

mukesh guptamukesh gupta
Hi Manoj,

Please gow through https://trailhead.salesforce.com/en/modules/apex_database

if you need any assistanse, Please let me know!!


Kindly mark my solution as the best answer if it helps you.

Thanks
Mukesh

 
SandhyaSandhya (Salesforce Developers) 
Hi,

Below is the code which worked for me.
 
public class ContactSearch {

    public static List<Contact> searchForContacts(String lastName,String postalCode){
        return [select LastName,MailingPostalCode from Contact
                where LastName = :lastName and MailingPostalCode = :postalCode order by LastName,MailingPostalCode desc];
    }
}

Please mark it as solved if my reply was helpful. It will make it available for other as the proper solution.
                                             
Best Regards
Sandhya