I need syntax help. Bit of a newbie trying to teach themselves IF/LIKE/OR
The specific task is to identify if a truck is a F-250,350, 2500, or 3500. The Column is "model" that I'm looking for the partial match in the model column. I keep getting syntax errors.
CASE
WHEN
`model`LIKE ‘%F 250%’
OR `model` LIKE ‘%F-250%’
OR `model` LIKE ‘%F250%’
OR `model` LIKE ‘%E-350%’
OR `model` LIKE ‘%E-250%’
OR `model` LIKE ‘%2500%’
OR `model` LIKE ‘%3500%’
THEN 110
When `Actual bid 2` > 2500 THEN 120
ELSE 110
END
Just kidding never mind I fixed it.
I needed to use IN instead of LIKE
CASE
WHEN `model`IN ('%F 250%')
OR 'model' IN ('%F-250%')
OR 'model' IN ('%F250%')
OR 'model' IN ('%F-350%')
OR 'model' IN ('%F350%')
THEN 110
When `Actual bid 2` > 2500 THEN 120
ELSE 110
END
Best Answer
-
Good troubleshooting. Quick tip: since you're using IN, you could simplify it down to a list instead of a bunch of ORs:
WHEN `model` IN ('%F 250%', '%F-250%', '%F250%', '%F-350%', '%F350%')
THEN 110
When `Actual bid 2` > 2500 THEN 120
ELSE 110Please 💡/💖/👍/😊 this post if you read it and found it helpful.
Please accept the answer if it solved your problem.
1
Answers
-
And I figured it out I needed to be using IN instead of LIKE
0 -
Good troubleshooting. Quick tip: since you're using IN, you could simplify it down to a list instead of a bunch of ORs:
WHEN `model` IN ('%F 250%', '%F-250%', '%F250%', '%F-350%', '%F350%')
THEN 110
When `Actual bid 2` > 2500 THEN 120
ELSE 110Please 💡/💖/👍/😊 this post if you read it and found it helpful.
Please accept the answer if it solved your problem.
1
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.6K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 103 SQL DataFlows
- 627 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 755 Beast Mode
- 61 App Studio
- 41 Variables
- 693 Automate
- 178 Apps
- 456 APIs & Domo Developer
- 49 Workflows
- 10 DomoAI
- 38 Predict
- 16 Jupyter Workspaces
- 22 R & Python Tiles
- 398 Distribute
- 115 Domo Everywhere
- 276 Scheduled Reports
- 7 Software Integrations
- 130 Manage
- 127 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 11 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 110 Community Announcements
- 4.8K Archive