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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:22:49+00:00 2026-05-27T12:22:49+00:00

I’ve been visiting this site for a while now and many of the responses

  • 0

I’ve been visiting this site for a while now and many of the responses on here has been most helpful. However, I’m now stuck with an SQL that I can’t seem to find just the right solution for.

(the $packplant and $ym is already defined earlier in the program)

SELECT 
    A.in_house_supplier_cd,
    B.maker_cd,
    A.packing_plant_cd,
    A.parts_no, 
    substr(A.actual_delivery_date,1,6), 
    A.actual_delivered_qty 
FROM 
    TRN_DELIVERY_NO A, 
    TRN_PARTS B 
WHERE 
    A.ISSUE_NO = B.ISSUE_NO 
    AND A.PACKING_PLANT_CD = '$packplant' 
    AND B.PACKING_PLANT_CD = '$packplant' 
    AND A.PARTS_NO = B.PARTS_NO 
    AND A.IN_HOUSE_SUPPLIER_CD = B.IN_HOUSE_SUPPLIER_CD 
    AND A.ACTUAL_DELIVERY_DATE LIKE '$ym%' 
ORDER BY 
    in_house_supplier_cd, maker_cd, parts_no;

This sql works fine. However, what I need is that the “A.actual_delivered_qt” to be sum(A.actual_delivered_qty)… in other words, I need the sum of that particular parts and not individual quantities that were received.

When I add the “sum..” part (or even with adding a GROUP BY parts_no), the sql gives a “column ambiguously defined” error.

I believe that I’ve already assigned the correct table to each column and therefore would really appreciate it if someone could point out the errors as I’ve been stuck with this for quite a while now. Cheers!

  • 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-27T12:22:50+00:00Added an answer on May 27, 2026 at 12:22 pm

    You will need to add a GROUP BY statement, for example on parts_no, but then you will have an issue with the rest of the columns in your select statement.

    For example, if you have 3 records for the same part no on different days and you are grouping by part_no and calculating the total number of items within that group number, the date no longer makes sense. The best you can do is select the max value from the date, but again, this doesn’t make much sense.

    You should think about what data really makes sense to include in the select statement when you are grouping by part_no and then revise the columns in the select statement to meet this new design.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a jquery bug and I've been looking for hours now, I can't
I want to count how many characters a certain string has in PHP, but
this is what i have right now Drawing an RSS feed into the php,
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
Basically, what I'm trying to create is a page of div tags, each has

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.