community postAL Developmentcommunity - not Microsoftreviewed - checked by Opus

Business Central Queries: Simplifying Complex Data

Business Central Query objects allow developers to combine data from multiple tables using joins and filters, similar to SQL queries. Queries simplify complex data retrieval by defining linked data items with columns and join types, and can be exposed in Business Central for analysis and reporting.

post Aardvark Labs

Marcel Chabot · 2025-06-27 · 1,231 words · about 6 min

"Queries are a nested set of linked and filtered data items."

Key points

  • Query objects let AL developers combine and filter data from several tables, giving some SQL-like capabilities without direct SQL access
  • A query starts with a source data item, and dependent data items are attached using DataItemLink, DataItemTableFilter and SqlJoinType
  • Left means the parent data item and Right means the nested dependent one; the post covers inner, left outer, right outer, full outer and cross joins
  • The example query joins Customer with Cust. Ledger Entry using a left outer join, filtered to invoices and credit memos
  • With UsageCategory set, the query can be found through Tell Me, exported to Excel or analyzed in pivot mode

Quotes

  • “Queries are a nested set of linked and filtered data items.” (This defines the core concept of how queries work as the fundamental unit for multi-table data retrieval)
  • “Left is the parent Data Item and Right is the dependent Data Item.” (Understanding the directional concept of joins in Business Central is critical for developers to write correct query syntax)

AL objects mentioned

As named in the post. A name that matches one object page by exact type and name links to it; the others stay as named.

Not found in BC28-30: query “ARD_CustomerLedger”.

Context

  • Features: Query objects, Data item linking, SQL join types, Table filtering, Column definition, Pivot analysis, Excel export

Source: Aardvark Labs, community blog. Summary, key points and quotes are derived (CONTENT-NOTICE.md); read the original for the full text.