Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9254037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:22:03+00:00 2026-06-18T11:22:03+00:00

Is there a way to multiply a column with a predefined number based on

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T11:22:04+00:00Added an answer on June 18, 2026 at 11:22 am

    Sure, you can use CASE:

    SELECT Persons_Id, Activity, Scale, 
       Scale * 
       CASE 
          WHEN Activity = 'swimming' THEN 6
          WHEN Activity = 'baseball' THEN 8
          WHEN Activity = 'basketball' THEN 5
          ELSE 1
       END Total
    FROM YourTable
    

    Good luck.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I'm selecting from multiple tables that share column names is there a way
Is there a way to plot multiple data for the same value x? For
Is there a way to actually get the column name that was updated in
Is there a quick way to insert multiple values into one column while the
Is there any way to use Dapper.NET with stored procs that return multiple result
Is there any way of sharing column widths between controls, not just between multiple
Is the there a way to multiply each NSNumber contained in the array by
Is there a way of handling multiple xhr requests like this? for one xhr
Is there a way to send multiple lines of text to the clipboard using
Is there a way to set multiple alsoResizes in jQuery UI? $('.selector').resizable({ alsoResize: '.other'

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.