#215 knowledge(performance): grouped query (Count + ColumnFilter = HAVING) for distinct values and duplicates
A new performance knowledge article teaches developers how to use query objects with grouped methods and column filters to detect duplicate values in a single SQL statement instead of looping with multiple queries.
- 5files
- 4AL files
- 0objects
Pull request · merged into main on 2026-10-05 by MichaelDieringer · 5 files (+110 -1), 4 AL · feature · tier official · reviewed (checked by Opus)
What changed
- Query objects with aggregate methods and HAVING filters replace loop-based duplicate detection
- Reduces SQL statements from table row count to one statement
- Complements existing guidance on grouped totals
- Includes code examples and verification against base application usage
- Added to performance review skill with filter-and-count loop detection
AL objects touched
microsoft/knowledge/performance/use-grouped-query-for-distinct-values-and-duplicates.bad.al: added, not in the BC? snapshot yetmicrosoft/knowledge/performance/use-grouped-query-for-distinct-values-and-duplicates.good.al: added, not in the BC? snapshot yetmicrosoft/knowledge/performance/use-grouped-query-for-distinct-values-and-duplicates.md: added, not in the BC? snapshot yetmicrosoft/skills/review/al-performance-review.md: modified, not in the BC? snapshot
Context
- Systems: development, platform
- From the description: “A query object does it in one statement.”
Source: metadata of a merged pull request in microsoft/BCQuality (bcquality): title, labels, changed paths and counts, with a summary in our words. No source text and no description beyond one short quote (D10, D61).