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

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.

主站蜘蛛池模板: 恭城| 湖南省| 元氏县| 孝感市| 望谟县| 文登市| 栾城县| 张掖市| 社旗县| 镇安县| 鹤山市| 永嘉县| 蒙自县| 周口市| 镶黄旗| 柘城县| 蒙山县| 轮台县| 海宁市| 翁牛特旗| 六安市| 禹城市| 新泰市| 祁东县| 兰州市| 洛南县| 永顺县| 清远市| 璧山县| 兴山县| 湘阴县| 鹰潭市| 屯留县| 沧州市| 靖江市| 原平市| 灌阳县| 濮阳县| 温泉县| 敖汉旗| 射洪县|