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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:35:54+00:00 2026-05-24T11:35:54+00:00

SELECT SUM (e.quantity) AS quantity ,e.tran_id ,e.SEQUENCE ,MAX (e.veh) AS veh ,a.DATE AS DATE

  • 0
SELECT SUM (e.quantity) AS quantity
  ,e.tran_id
  ,e.SEQUENCE
  ,MAX (e.veh) AS veh
  ,a.DATE AS DATE
  ,a.aloc_sequence
  ,CASE
     WHEN a.currency = 'USD' THEN e.COST
     ELSE e.COST * getrate ('ABC'
                           ,a.currency
                           ,a.DATE
                           )
   END AS cost
FROM   execution e
  ,vehicles v
  ,allocation a
WHERE    e.vehicle = v.vehicle
AND      a.part_id = e.part_id
AND      a.aloc_sequence = e.aloc_sequence
GROUP BY e.tran_id
    ,e.SEQUENCE
    ,date
    ,a.aloc_sequence

I dont want to include the cost (that has been calculated using case staement in SELECT)
in group by clause ,please help me .
I am using oracle as rdbms

  • 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-24T11:35:55+00:00Added an answer on May 24, 2026 at 11:35 am

    When you use a group by, you are essentially consolidating many rows into one. You either GROUP BY a column, which guarantees that the value is the same for every row in the group, or you aggregate the values is some way (min, max, avg etc)

    If you don’t specify a column in the group by, there is ambiguity about which value to return (since they aren’t in the group by they could be different and you need to be explicit about which one you want)

    You could wrap an aggregate around COST i.e. SUM(cost) if you want the sum, or MAX(cost) if they are always going to be the same from row to row (although why not just group by then?)

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

Sidebar

Related Questions

So I have a SQL Query as Follows SELECT P.Date, P.CategoryName, P.ProductName, SUM(Quantity) Quantity,
Alright. I have a query that looks like this: SELECT SUM(`order_items`.`quantity`) as `count`, `menu_items`.`name`
Let's say I have a table: SELECT SUM(quantity) AS items_sold_since_date, product_ID FROM Sales WHERE
I'm using MS SQL, and here is my query... SELECT SUM(Quantity) FROM table1 WHERE
Hey all, this is my query string here: SELECT SUM(Total) as Total, AdministratorCode, SUM(WOD.Quantity)
Calling the UDF like so: SELECT product_name, SUM(quantity) AS SumQty, SUM(face_value) AS SumFaceValue, SUM(net_cost)AS
select p.Id, sum(inc.Quantity) from Products p join Incomes inc group by p.Id order by
Query: ;WITH SuperSelect AS ( SELECT DISTINCT DropshipPackinglist.CaseNumber AS 'CASE NO.', DropshipPackinglist.Quantity AS 'QTY'
So here is the original query SELECT SUM(PickQty), SUM(ReqQty), AssignmentID, StopID FROM PickRequest GROUP
function get_total_adults() { $sql = SELECT SUM(number_adults_attending) as number_of_adults FROM is_nfo_rsvp; $result = mysql_query($sql)

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.