In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests after December 31, 2025. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

In Database Filtering

ba13891
6 - Meteoroid

I have an in database connection to an EDL table and I want to exclude certain data criteria based on multiple columns.

 

I have included a very simplified table example below.  I would like to filter dataset to only keep "Value" data where Column 1 = TL and Column 2 = LOGI,  AND  where Column 1 = O and Column 2 = DZNA.  Essentially, eliminating/keeping rows based on specified column 1 and column 2 relationships.  Any tips on how to do this?

 

 

Column 1    Column 2   Value

TL                 DZNA        100

TL                 LOGI         1400

TL                 LOGN        2000

O                  DZNA         105

O                  EGTD         100

 

8 REPLIES 8
binu_acs
21 - Polaris

@ba13891 

 

([Column 1] = "TL" And [Column 2] = "LOGI")
OR
([Column 1] = "O" And [Column 2] = "DZNA")
alexnajm
19 - Altair
19 - Altair

Can you build your filter with the Filter In-DB tool? The language may change depending on the database, but generally:

(Column 1 = "TL" and Column 2 = "LOGI") OR (Column 1 = "O "and Column 2 = "DZNA")

ba13891
6 - Meteoroid

Thanks for responding.  Filter In-DB tool accepted your the language you proposed. 

 

Do you know how I can take this a step further, and include multiple Column 2 variables?  For example, (Column 1 = "TL" and Column 2 = "LOGI", "LOGN", "LOGP").  I tried adding variables like shown; however, the Filter In-DB errored out.

 

Thanks!

alexnajm
19 - Altair
19 - Altair

It all depends on the language of the database, but you might try the IN function. 
Column 2 IN (“x”,”y”,”z”)

ba13891
6 - Meteoroid

I input the following and received a PARSE_SYNTAX_ERROR.  syntax error at or near the end of input.  Anything look off with below?

 

(`COLUMN 1` = "TL" and `COLUMN 2` IN ("LOGI","FLET","LOGN") OR (`COLUMN 1` = "O" and `COLUMN 2` = "DZNA")

alexnajm
19 - Altair
19 - Altair

You have an extra parenthesis at the beginning. 

`COLUMN 1` = "TL" and `COLUMN 2` IN ("LOGI","FLET","LOGN") OR (`COLUMN 1` = "O" and `COLUMN 2` = "DZNA")

ba13891
6 - Meteoroid

THANK YOU!

alexnajm
19 - Altair
19 - Altair

Happy to help!

Labels
Top Solution Authors