Question

I need help creating an SQL for this question. Make a list of Sales for February...

I need help creating an SQL for this question. Make a list of Sales for February 2014. Include the Sale ID, SaleDate, the total number of items sold (sum of quantity), and the total amount (sum of quantity times sale price) for each sale. Sort the output by SaleID. Name the new fields ItemCount and SaleTotal.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

SELECT SaleID,SaleDate,COUNT(ProductID) AS ItemCount,SUM(SalePrice) AS SaleTotal FROM Sale INNER JOIN SaleItem ON Sale.SaleID=SaleItem.SaleID GROUP BY ProductID WHERE month(SaleDate)=2 AND year(SaleDate)=2014

/* Doubts, corrections would be appreciated in comments*/

Add a comment
Know the answer?
Add Answer to:
I need help creating an SQL for this question. Make a list of Sales for February...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT