You may not need to specify every setting in the 'Subquery' dialog box. The required menu choices depend on how you wish to use the subquery result set. This section explains three different cases for using a subquery.
If the subquery returns a single fixed value (i.e., the subquery table in the Worksheet contains a single cell), then in the 'Subquery' dialog box you only need to specify the name of the subquery. No further settings are required.
If you want to use a particular column from the subquery as a fixed list in the condition, you need to specify the query name in the 'Subquery' dialog box, and then select the desired subquery column from the 'In column' menu.
A subquery that returns a column is typically used in conjunction with the 'one of' condition clause to filter values that are members (or non-members) of the returned list. You do not need to make selections in the 'Subquery column' and 'Current table column' menus.
A subquery can return a value that is dependent on the row of the main table. Such a row-dependent subquery is useful when you want to filter rows of the main table based on a comparison with corresponding rows of another table (i.e., the subquery table).
For example, consider a case where one table displays sales by year for NY, and a second table displays sales by year for CA. You want the NY table to display records only for those years where sales were greater than sales in CA. For instance, you want the NY table to display the record for year 2002 only if sales in NY for 2002 were greater than sales in CA for 2002.
To configure a row-dependent subquery, follow these steps:
The 'Subquery column' and 'Current table column' serve to connect the subquery table and main table. For each row in the main table, the value in the 'Current table column' is matched against the values in the 'Subquery column'. The results returned by the subquery for each row are the values of the condition 'In column' in the rows where the 'Subquery column' value is matched.
Copyright © 2024, InetSoft Technology Corp.