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

  • Home
  • SEARCH
  • 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 7049527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:01:41+00:00 2026-05-28T03:01:41+00:00

I am currently playing with the Northwind Sample database that ships with SQL Server.

  • 0

I am currently playing with the Northwind Sample database that ships with SQL Server. I am trying to write a query for finding “Customers who has spent more than $25,000 in orders with Northwind”. In the same context I have written the following query:

select a.customerid, sum (b.unitprice*b.quantity) as Total_Amount
from orders a join [order details] b on a.orderid=b.orderid
--where Total_Amount > 25000  --ERROR: In this filter condition, SQL Server is not recongnizing "Total_Amount"
group by a.customerid
order by Total_Amount desc

The query seems to be working correctly except for the fact that I am unable to put the filter condition (of 25000, pls refer to the commented line in the query) as it seems SQL Server does not recognize alias names (i.e.,Total_Amount), in the filter condition. However it is recognizing the alias in the Order By clause.

Pls help me with the right approach to this query and what would be the possible work arounds?

Thanks,
XM

  • 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-28T03:01:41+00:00Added an answer on May 28, 2026 at 3:01 am
    Select * FROM (
    select a.customerid, sum (b.unitprice*b.quantity) as Total_Amount
    from orders a join [order details] b on a.orderid=b.orderid
    --where Total_Amount > 25000  --ERROR: In this filter condition, SQL Server is not recongnizing "Total_Amount"
    group by a.customerid
    ) as a
    WHERE a.Total_Amount > 25000
    order by Total_Amount desc
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently playing with Qt trying to set up a small particle system.
I'm currently playing a bit with couchdb. I'm trying to migrate some blog data
I am currently playing with Sencha Touch, and I'm trying to get data from
Good night :) I am currently playing with the DevIL library that allows me
I am currently playing around with the FCKEditor, and I am trying to replicate
I'm currently playing around with the pre and post build events in VS2010, trying
I am currently playing around with and reading up on Prism. I know that
I am currently playing with Spring/JPA/Google App Engine, and there is an issue that
I am currently playing with tfs2010 and realized that the build scripts are in
I am trying to pause the AVAudioPlayer if it is currently playing. When 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.