In Dynamics 365 for Finance and Operations, SQL statements can often become performance bottlenecks. Therefore, it is very important to understand how Visual Studio handles database queries and to follow all the best practice recommendations in order to keep your system healthy and efficient.
In this recipe, we will discuss some of the best practices to use when writing database queries. For demonstration purposes, we will create a sample find method with different logic and queries and discuss each of them. The method will locate the CustGroup table record of the given customer account.