As an extension of the last post about filters and selection steps, we will focus our attention on writing logical SQL statements to help write more flexible ways to limit our data writing case statements.
If you want to write logical SQL for the where clause in the query we will have to use the filtering option over the selection steps because we’re able to convert filters into SQL which we can customize or we can add a SQL statement straight to the filter without converting it. [message_box title=”NOTE” color=”yellow”]Once you convert a filter to SQL you will not be able to revert it back to the original dialog box and will only be able to edit it in the Advanced SQL Filter box. [/message_box] A powerful feature of the filters is that it allows you to write SQL statements and that will affect the where clause of an analysis. This allows you to potentially write more complex statements for your filtering needs. Unfortunately, the Selection Steps option does not allow this option and may be a limiting factor in using the selection steps for limiting the data. Selection steps do allow you to use a good amount of logical statements to limit your data but you cannot code it yourself.
To in order to create an advanced SQL filter, navigate to the Criteria tab of your analysis and create a filter for one of your columns:
Once you select “Convert this filter to SQL” the next box will allow you to write your own SQL code for the filter, if there are more options selected before you convert your SQL, it will convert that as well.
This feature is generally not necessary but it is good for users who want advanced filtering capabilities.