Case Statement with AND function in SQL
I am using below query to mark the two fileds as 'Exclude'
SELECT *, CASE WHEN `account_number` = 20160001 and `document_number` = 57290 and `distribution_date` = '12/29/2018' then 'exclude'
WHEN `account_number` = 40200001 and `document_number` = 57290 and `distribution_date` = '12/29/2018' then 'exclude'
else 'Include' end as `GL FILTER` from `table`
However, I get the following result: the GL FIlter is 'Include' I want it to be 'Exclude'
Could anyone please help.
- 10.7K All Categories
- 13 Getting Started in the Community
- 31 Beastmode & Analytics
- 2.1K Data Platform & Data Science
- 59 Domo Everywhere
- 2.7K Charting
- 2.4K Ideas Exchange
- 1.3K Connectors
- 362 Workbench
- 301 Use Cases & Best Practices
- 500 APIs
- 118 Apps
- 48 News
- 753 Onboarding
- 1.1K 日本支部
- Private Company Board