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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:19:26+00:00 2026-05-26T21:19:26+00:00

I run a query, where I count several sum s on the different fields

  • 0

I run a query, where I count several sums on the different fields of same database entity. My problem arises when I am running tests on the query and at the same time changing the query from Mysql to the native language used on tests in IntelliJ Idea tool (I don’t know what it uses).

Problem is this: in the new environment all sum statements inside the single query return the value equal to the one that is got of the first sum statement.

I am using JPA and NativeQuery.

More information:

I have a code like this

List < Object [ ] > row = List < Object [ ] > em.createNativeQuery(“select sum (e.field), sum (e.otherField) from entity e where somevalue = something”).getResultList();

and then

return new MyResult ( ( Double ) row.get ( 0 ) [ 0 ] , ( Double )row.get ( 0 ) [ 1 ] );

Everything is inside a doInJPA function.

  • 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-26T21:19:26+00:00Added an answer on May 26, 2026 at 9:19 pm

    Real issue was identified to be so that my Idea used for testing HSQL and that somehow does not support sum in the same way that Mysql does.

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

Sidebar

Related Questions

When I run the query : select count(*) from (select idCover from x90..dimCover group
If I run a query such as: SELECT COUNT(*) as num FROM table WHERE
When I run query number 1: SELECT id, name, COUNT(name) AS count FROM markers
I need some performance improvement guidance, my query takes several seconds to run and
When I run this query: SELECT m.tag_id, m.product_id, count(m.product_id) as dups FROM product_tag_map m
I have a count calculation query which I am running thousands of times in
private Cursor getContacts() { // Run query Uri uri = ContactsContract.Contacts.CONTENT_URI; String[] projection =
I want to run a query to get a string array of distinct logName
I have code to run sql query in ruby as follows sql = ActiveRecord::Base.connection()
If I try to run this query in SQL Server 2005: SELECT 1 WHERE

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.