- Having is used only with the SELECT statement but WHERE clause can be used with Select, Update and Delete statement.
- Having Clause is used to filter group while WHERE clause is used to filter rows.
- WHERE clause is used to fetch particular records and this clause is applied after select statement but having clause is used for combination of group by functions.
- Having clause is typically used in GROUP BY clause, without using GROUP BY function you can not write the having clause.
- Having clause works only to columns that also appear in the Group by clause or in an aggregate function.
- Where clause is applied prior the grouping of data, while having clause is specified after grouping the result of the data.
Where And Having Clause Difference in SQL
How to access Dynamics CRM filtered views using a SQL account
- Create SQL Account
- Add CRMReaderRole role to the account where the organization database to access
- Get the GUID for the Dynamics CRM user you would like to impersonate.
- Use the Transact-SQL SET CONTEXT_INFO to set the context information to this GUID before querying the filtered view.
DECLARE @uid uniqueidentifier
SET @uid = convert(uniqueidentifier, 'user_guid')
SET CONTEXT_INFO @uid
SELECT * FROM [FilteredLead] - The query will return the records as if you were connected using the given user's Windows account. It should be noted that the SET CONTEXT_INFO is only required when establishing the connection, and once set will remain so for the duration of the session
Source: crmland
Subscribe to:
Posts (Atom)