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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:10:15+00:00 2026-05-11T20:10:15+00:00

I have an absolutely baffling case in front of me. I have two database

  • 0

I have an absolutely baffling case in front of me. I have two database environments, A and B, where environment B has been created from a backup of A. I’m running a rather simple query:

SELECT
    customers.customerName           (* varchar(100), not null *)
    ,countries.countryName           (* varchar(100), not null *)
    ,Balance = Sum(invoices.Amount)  (*        money, not null *)
FROM invoices
INNER JOIN customers
    ON customers.customerID = invoices.customerID
INNER JOIN countries
    ON countries.countryID = customers.countryID
GROUP BY
    customers.customerName
    ,countries.countryName
HAVING
    Sum(invoices.Amount) <> 0
ORDER BY
    customers.customerName

The query returns a list of users who have a non-zero balance on their invoice. The results from environment A resemble the following:

customerName        countryName        Balance
------------        -----------        -------
A                   United States       20.0000
B                   United States       -5.0000
C                   Canada             199.9900
D                   Canada              -0.0100
E                   United States       55.5900

The results on environment B are as follows:

customerName        countryName        Balance
------------        -----------        -------
A                   United States       10.0000
A                   United States       -5.0000
A                   United States       -1.0000
A                   United States       17.0000
A                   United States       -1.0000
B                   United States       -1.0000
B                   United States       -4.0000
C                   Canada             100.9900
C                   Canada              99.9900
...

Query works fine on Environment A, but it looks as if the GROUP BY clause is being ignored altogether in Environment B.

The query works as expected when I comment out Sum(invoices.Amount) from the SELECT and HAVING clause, so its definitely connected to my invoices.Amount field.

I’ve backed up A and restored it to B, and SqlDelta (a diff tool for databases) shows that databases are identical, so its not a data issue, it has to be a configuration problem — but I have no idea where to look.

In case its relevant, both environments are using SQL Server 2000 on a Windows Server 2003. Both environments are installed on two separate servers, separate instances of SQL Server, and separate instances of Windows Server 2003.

What could cause SQL server not to group the invoices.Amount field?

  • 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-11T20:10:15+00:00Added an answer on May 11, 2026 at 8:10 pm

    It turns out there was no error with the query, it was an environment problem. Environment A had SQL Server 8.0.2039, where environment B has SQL Server 8.0.1053. I’ve updated environment B with the latest service packs and now my query works as expected.

    Thanks for your suggestions everyone :), but now I have a new problem: who to kill at Microsoft for this hassle.

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

Sidebar

Related Questions

I have an absolutely positioned div that has a width of 100% with a
I have a div that is absolutely positioned from the top left corner of
i've been trying to figure this out and i have absolutely no clue why
Over the last little while I have been encountering some crashes that are absolutely
I have created a console application which transfers data from an excel sheet and
I have absolutely no idea where this memory leak is from. None of the
So I have absolutely no logic in my code. I have the two methods
I have absolutely no succes in getting IE 10 to display custom fonts. Has
I have absolutely no experience with AS400 DB2 so please forgive any glaring mistakes
I have absolutely no access to a machine with IE on it right now

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.