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 data from a table in a database (string) that contain text and
I have a table that has redundant data and I'm trying to identify all
I have to build an HTML table that shows data for users versus pages
I have a main table that I must get data from. I have a
I have to delete some rows from a data table. I've heard that it
I have a rather large (many gigabytes) table of data in SQL Server that
Many applications have grids that display data from a database table one page at
I have a long running insert transaction that inserts data into several related tables.
I have a star schema type data base, with fact tables that have many
I have to write a component that re-creates SQL Server tables (structure and data)

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.