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
- 2K Product Ideas
- 2K Ideas Exchange
- 1.6K Connect
- 1.3K Connectors
- 308 Workbench
- 7 Cloud Amplifier
- 10 Federated
- 3.8K Transform
- 660 Datasets
- 117 SQL DataFlows
- 2.2K Magic ETL
- 818 Beast Mode
- 3.3K Visualize
- 2.5K Charting
- 84 App Studio
- 46 Variables
- 781 Automate
- 191 Apps
- 483 APIs & Domo Developer
- 84 Workflows
- 23 Code Engine
- 43 AI and Machine Learning
- 22 AI Chat
- 3 AI Projects and Models
- 18 Jupyter Workspaces
- 408 Distribute
- 116 Domo Everywhere
- 281 Scheduled Reports
- 11 Software Integrations
- 146 Manage
- 142 Governance & Security
- 8 Domo Community Gallery
- 49 Product Releases
- 13 Domo University
- 5.4K Community Forums
- 41 Getting Started
- 31 Community Member Introductions
- 115 Community Announcements
- 4.8K Archive