How to Use Subquery with Alias Names in Bold Reports
Bold Reports allows users to construct comprehensive datasets with ease by leveraging subqueries with alias names. This feature enables users to efficiently organize and manipulate data, enhancing the flexibility and effectiveness of their queries. This knowledge base article provides a step-by-step guide on how to add a sub-query to the main query using the Bold Report designer tool.
Steps to Add Subquery into Main Query
-
Open the report designer and connect your DataSource to the report.
-
Open Query Designer Tool to design the dataset with a subquery using your SQL data source as shown in the query below, and provide an alias name to the subquery like TotalAmountForProductCategory.
SELECT Orders.OrderID, Orders.CustomerID, ( SELECT SUM(OrderDetails.Quantity * OrderDetails.UnitPrice) FROM OrderDetails WHERE OrderDetails.OrderID = Orders.OrderID AND OrderDetails.ProductCategory = @ProductCategory ) AS TotalAmountForProductCategory FROM Orders WHERE Orders.OrderDate >= @OrderDate
-
Drag and drop a table report item onto the design interface and configure the field values.
-
Preview your report. Provide values to the parameters (ProductCategory and OrderDate). You will get the output as shown below for your subquery with an alias name.
Bold Reports offers a powerful solution for constructing comprehensive datasets using subqueries with alias names. By following the steps provided above, you can construct comprehensive datasets using subqueries with alias names, offering a more efficient way to manage and manipulate data.