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

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.

主站蜘蛛池模板: 云梦县| 霸州市| 仲巴县| 三原县| 津市市| 乌拉特中旗| 鲜城| 吉木萨尔县| 遵义县| 建阳市| 那坡县| 崇文区| 鄂尔多斯市| 南乐县| 武定县| 舟曲县| 徐水县| 建平县| 铁力市| 安溪县| 佳木斯市| 桦川县| 循化| 周口市| 海原县| 云浮市| 秦皇岛市| 保定市| 西吉县| 凉山| 会宁县| 宣武区| 台东县| 中宁县| 嘉黎县| 板桥市| 钟祥市| 八宿县| 黄浦区| 荔波县| 南汇区|