官术网_书友最值得收藏!

Creating nested filters

Nested filters are used when the query requires a more complex set of conditions.

Nested filters mean there is a priority set to a group of conditions while the other group or groups are set with a different priority.

The most basic rule is that the AND operation is prioritized before the OR operation.

Nesting filters allow us to ask more complex questions but implement them easily with the drag-and-drop method.

Getting ready

We are required to set these conditions in the query: retrieve the sales revenue for USA for the car maker Leep (there is an AND relation between the first two conditions) OR retrieve Model Colours that equal BLACK.

How to do it...

We will create the three conditions by dragging-and-dropping the relevant objects from the universe structure to the Query Filters pane:

  1. In order to create a nested filter between the first and the second filter, we will drag-and-drop the Country filter on the Maker filter, as shown in the following screenshot:
  2. The result will be a nested filter that is bound with a bracket, as shown here:
  3. We click on the external And operation and turn it into the Or operation, as shown here:
  4. We will get the following results on clicking on the Run query button:

Examining the results will show data for the car maker Leep in USA (the AND condition) as well as the countries and makers' sales revenue with black color models (the OR condition).

How it works...

Nested filters use brackets in order to prioritize filter groups. By using the simple drag-and-drop technique, we can establish a relatively complex statement of filters. This makes it a very flexible method of querying.

There's more...

Filters can be further nested into more complex subsets. There is no limit to the number of possible conditions that can be put in one query; however, we need to remember that the more conditions we create, theoretically, we are decreasing the number of rows that will be returned. On the other hand, the query is requested to execute more functions in order to retrieve the data.

主站蜘蛛池模板: 云南省| 斗六市| 板桥市| 博乐市| 沙雅县| 台南市| 元朗区| 尉犁县| 鸡西市| 营山县| 通山县| 阳山县| 定州市| 兴山县| 偏关县| 娄底市| 如皋市| 班戈县| 萨迦县| 普格县| 江源县| 东山县| 安阳市| 宜兴市| 永平县| 南漳县| 黄冈市| 右玉县| 明光市| 镇平县| 滨州市| 乌拉特中旗| 类乌齐县| 沛县| 建瓯市| 平果县| 霸州市| 呈贡县| 张家口市| 绵竹市| 社旗县|