Solved

SQL Questions

Posted on 2013-01-14
2
201 Views
Last Modified: 2013-01-15
I need a query to get the below points:  Tables are in the attached document.  Thanks.

What would be the discounts for each line item on orders of five or more units?

o      Columns to display: Orderid, Partid, Description, Qty, UnitPrice, OriginalCost, QuantityDeduction, and FinalCost

o       give quantity discounts to encourage more sales.
·      If an order contains five or more units of a given product we will give a 2% discount for that line item.  
·      If an order contains ten or more units of a given product we will give a 5% discount on that line item.

o      Produce output that prints the orderid, partid, description, qty ordered, unit list price, the total original price(qty ordered * list price),  the total discount value (shown as money or percent), and the total final price of the product after the discount.

o      Display only those line items subject to the discount in ascending order by the orderid and partid.

o      Use the CASE statement.
sqltables.doc
0
Comment
Question by:ocdc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 78

Accepted Solution

by:
arnold earned 500 total points
ID: 38777212
Is this a class assignment.

You can use quantity order divided by the threshold cast as int and is multiplied by the discount.
Can you post the query you are considering and what issues are you having with the query?
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question