Is there a way to multiply a column with a predefined number based on another column? There are multiple predefined numbers that are used depending on the value in the column.
Example:
Table
Columns: persons_id,activity,scale
Values
1,swimming,4
1,baseball,2
1,basketball,3
2,swimming,6
2,basketball,3
If my predefined numbers are: 6 (swimming), 8 (baseball), 5 (basketball)
The output would look like this
1,swimming,4,24
1,baseball,2,16
1,basketball,2,10
2,swimming,6,36
2,basketball,3,15
Edit: Thank you everyone for contributing. I ended up using the solution from sgeddes.
Sure, you can use
CASE:Good luck.