Articles in this section
Category / Section

How to Use Subquery with Alias Names in Bold Reports

Published:
Updated:

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.

    image.png

       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.

    image.png

  • 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.

    image.png

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.

Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied