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
- 311 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 3.8K Transform
- 659 Datasets
- 116 SQL DataFlows
- 2.2K Magic ETL
- 816 Beast Mode
- 3.3K Visualize
- 2.5K Charting
- 82 App Studio
- 45 Variables
- 776 Automate
- 190 Apps
- 481 APIs & Domo Developer
- 82 Workflows
- 23 Code Engine
- 41 AI and Machine Learning
- 20 AI Chat
- 1 AI Playground
- 2 AI Projects and Models
- 18 Jupyter Workspaces
- 411 Distribute
- 120 Domo Everywhere
- 280 Scheduled Reports
- 11 Software Integrations
- 144 Manage
- 140 Governance & Security
- 8 Domo Community Gallery
- 48 Product Releases
- 12 Domo University
- 5.4K Community Forums
- 41 Getting Started
- 31 Community Member Introductions
- 115 Community Announcements
- 4.8K Archive