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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:11:41+00:00 2026-06-07T04:11:41+00:00

I have a query like this SELECT tableA.field1, SUM(tableB.field4) AS the_sum FROM tableA LEFT

  • 0

I have a query like this

SELECT
  tableA.field1,
  SUM(tableB.field4) AS the_sum
FROM
  tableA 
  LEFT JOIN tableB ON tableA.field1 = tableB.field2
WHERE
  /* IN() for multiple possible vals. Use = if only 1 val needed
     and then the GROUP BY is unnecessary */
  tableA.field1 IN ('val1','val2',val3')
GROUP BY tableA.field1

how to implement the following query in hibernate?. and also i need to return the value as the objects of the curresponding tables. Is it possible?

  • 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-06-07T04:11:42+00:00Added an answer on June 7, 2026 at 4:11 am

    The query would be almost identical:

    select a.field1, sum(b.field4) as the_sum
    from EntityA a left join a.b
    where a.field1 in ('val1', 'val2', 'val3')
    group by a.field1
    

    That is assuming that there is an association from EntityA to EntityB using a.field1 as a foreign key to b.field2 (or vice-versa). If you don’t have such an association, it’s impossible. left joins are only possible with associations.

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

Sidebar

Related Questions

I have a query like this: SELECT fields FROM table WHERE field1='something' OR field2='something'
I have query like this : SELECT EXTRACT(MONTH FROM d.mydate) AS synmonth, SUM(apcp) AS
I have a select statement like this select field1, field2 from table1 What I
I have the following query: SELECT table_a.field1, table_b.field1 FROM table_a, table_c LEFT JOIN table_b
I like to have a query like this: select data from table where (x
i have this sql query select * from table where name like ? but
I have a query like this: select empno,name from emp where job = 'CLERK'
I have a query like this: SELECT COUNT(*) AS amount FROM daily_individual_tracking WHERE sales
I have a query like this SELECT TOWN, NAME FROM CINEMA WHERE CITY_ID =
I have a query like this SELECT user_id FROM user WHERE user_id NOT IN

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.