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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:30:19+00:00 2026-05-27T15:30:19+00:00

I have to display about 5 columns from 2 database tables using the Group

  • 0

I have to display about 5 columns from 2 database tables using the Group By clause as follows:

SELECT T1.COLUMN_A, T1.COLUMN_B, T1.COLUMN_C, SUM(T2.COLUMN_D)
FROM TABLE1 T1, TABLE2 T2
WHERE T1.COLUMN_A = T2.COLUMN_A
GROUP BY T1.COLUMN_A

Now COLUMN_B has the same value across all the rows having the same COLUMN_A and COLUMN_B is a amount field.
COLUMN_C is a date field and would be same across the same COLUMN_A values.

Ex. Here is dummy data TABLE T1

COLUMN_A           COLUMN_B          COLUMN_C
1                    $25               09/15/2911 12:00:00 AM
1                    $25               09/15/2011 12:00:00 AM
2                    $20               12/12/2011 12:00:00 AM
...

TABLE T2:

COLUMN_A       COLUMN_D
1                $100
1                $10
2                $200
2                $200
.....

Running the query does not work with following error: ORA-00979: not a GROUP BY expression

Removing COLUMN_B and COLUMN_C would work. However I need these columns as well.

Can anyone please suggest the required changed?

  • 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-27T15:30:20+00:00Added an answer on May 27, 2026 at 3:30 pm

    This should work

    SELECT T1.COLUMN_A, T1.COLUMN_B, T1.COLUMN_C, SumColumnD
    FROM TABLE1 T1 
         INNER JOIN 
         (SELECT COLUMN_A, SUM(COLUMN_D) AS SumColumnD
          FROM TABLE2 T2
          GROUP BY COLUMN_A) t ON T1.COLUMN_A = t.COLUMN_A
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a GridView that needs to display either x amount of columns from
I am just begining php and mysql. I have two queries from my database.
Hello everybody Well my question is about sql commands... If I have 2 tables
I have a snippet of code that writes the data alphabetically from a database
I have models corresponding to database tables. For example, the House class has color,
I have a fairly large database containing a number of different tables representing different
I have a UITableView which displays about 5 cells at a time, yet in
The Particulars: I have a report that displays information about invoices. There is a
Let's say that I have a widget that displays summary information about how many
When you set an html element to have display: none , the content inside

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.