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 394717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:22:59+00:00 2026-05-12T16:22:59+00:00

I have data in table a that i want to quench and create into

  • 0

I have data in table a that i want to quench and create into another table b. Wondering how to do this. I was thinking of doing nested CASE expressions. But is this do-able?

For eg:-

Table a:-

S En Eg

-0.2 7888 99
90 9000 788
100 999 888

I want to create another table b, that does this:-

select
CASE WHEN S < 0 then (S+1/En-Eg)
ELSE (S-1/En-Eg)) END AS Z
from a

I also want to compare Z with other values:-

If z > 0 then ‘Good’
else ‘Bad’

Something like that, can i do this inside table b as well?

  • 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-05-12T16:23:00+00:00Added an answer on May 12, 2026 at 4:23 pm

    You could “reuse” the CASE expression if you performed it in a subquery:

    SELECT z, CASE WHEN z > 0 THEN 'Good' ELSE 'Bad' END AS zdesc
    FROM (
        SELECT CASE WHEN S < 0 
            THEN (S + 1 / En - Eg)
            ELSE (S - 1 / En - Eg) END AS z 
        FROM a
    ) b
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the data table from the jquery plugin dataTables (http://datatables.net/) that I want
I have a long list of data that I want to display in table
I have a scripts that retrieves huge data on a table. I want to
I have a data.frame and I'm trying to create a frequency table that shows
I have a table that I am entering data into every day. But I
I have a DetailsView control that I want to populate with a data table.
I have a table data (td) that has a title on it. I want
I have data from an Excel spreadsheet that I want to import into a
I have a table that looks like this: CREATE TABLE [Test].[dbo].[MyTest] ( [Id] INT
I have data in a SQL Server 2008 table that looks like this: I

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.