Solved

SQL Procedures

Posted on 2009-05-09
2
200 Views
Last Modified: 2012-05-06
I have the following problem that I am to answer. Any idea

Write a procedure that takes 5% off of the list price of all of the books that were written by the author who sold the most books in the previous month.  If, for example, the current month is October when the procedure is invoked, it would find the author who sold the most books in September and then discount all of that authors books by 5%



0
Comment
Question by:iolike
[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 75

Accepted Solution

by:
Aneesh Retnakaran earned 500 total points
ID: 24346630

create procedure updFivePercentage
as
UPDATE Book
SET SoldPrice = 0.95 * SoldPrice
WHERE AuthorID = (SELECT TOP 1  AuthorID
                  FROM SalesTable
                  WHERE Month (SalesDate) = MONTH(GETDATE() ) -1  
                  GROUP BY AuthorID
                  ORDER BY COUNT(*) DESC
                  )
0
 

Author Closing Comment

by:iolike
ID: 31579849
Thanks
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Recently, when I was asked to create a new SQL 2005 cluster, Microsoft released a new service pack for MS SQL 2005 what is Service Pack 3. When I finished the installation of MS SQL 2005 I found myself troubled why the installation of SP3 failed …
I am showing a way to read/import the excel data in table using SQL server 2005... Suppose there is an Excel file "Book1" at location "C:\temp" with column "First Name" and "Last Name". Now to import this Excel data into the table, we will use…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

719 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