0

I need to fix this query so that it will give me the part number, part description and on hand value for each part in the SG class. This is what I have so far. but it just gives me the total value of all the items in the SG class. How can I have it where it will give me the total based on the description?

SELECT PART_NUM, DESCRIPTION, SUM(ON_HAND * PRICE) AS ON_HAND_VALUE
FROM PART
WHERE CLASS = 'SG'

PART_NUM    DESCRIPTION     ON_HAND_VALUE
BV06          Home Gym         48282.75

Part Table "All the items in the SG class"

PART_NUM    DESCRIPTION     ON_HAND     CLASS   WAREHOUSE   PRICE
    BV06       Home Gym       45          SG         2      794.95
    KV29       Treadmill       9          SG         2      1390.00

2 Answers 2

1

How can I have it where it will give me the total based on the description?

Add the Group By clause

SELECT PART_NUM, DESCRIPTION, SUM(ON_HAND * PRICE) AS ON_HAND_VALUE
FROM PART
WHERE CLASS = 'SG'
GROUP BY DESCRIPTION
Sign up to request clarification or add additional context in comments.

Comments

0

Add..

Group By Part_Num, Description

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.