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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:15:05+00:00 2026-05-13T10:15:05+00:00

If I want to use the alias in the same query how do I

  • 0

If I want to use the alias in the same query how do I do that? For example, consider Table name xyz with columns a and b

select (a/b) as temp, temp/5
from xyz

Is this possible in some way?

  • 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-13T10:15:05+00:00Added an answer on May 13, 2026 at 10:15 am

    You are talking about giving an identifier to an expression in a query and then reusing that identifier in other parts of the query?

    That is not possible in Microsoft SQL Server which nearly all of my SQL experience is limited to. But you can however do the following.

    SELECT temp, temp / 5
    FROM (
        SELECT (a/b) AS temp
        FROM xyz
    ) AS T1
    

    Obviously that example isn’t particularly useful, but if you were using the expression in several places it may be more useful. It can come in handy when the expressions are long and you want to group on them too because the GROUP BY clause requires you to re-state the expression.

    In MSSQL you also have the option of creating computed columns which are specified in the table schema and not in the query.

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

Sidebar

Ask A Question

Stats

  • Questions 277k
  • Answers 277k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Joshua already mentioned F7. You can also do partial history… May 13, 2026 at 3:05 pm
  • Editorial Team
    Editorial Team added an answer Regex and sed are not very good tools for processing… May 13, 2026 at 3:05 pm
  • Editorial Team
    Editorial Team added an answer Okay...my issue was that I used the script/generate to create… May 13, 2026 at 3:05 pm

Related Questions

I have two tables, DH_MASTER and DH_ALIAS . DH_MASTER contains information about a person,
The following query returns a single row, as desired. The 'contracts' table has 6
All of my users are a short walk down the hall, and all of
I have the following alias in my .aliases: alias gi grep -i and I
If I use TextRenderer.DrawText() using the Graphics object provided in the OnPaintBackground my text

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.