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
Solved

SQL Procedures

Posted on 2009-05-09
2
198 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
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 Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

If you having speed problem in loading SQL Server Management Studio, try to uncheck these options in your internet browser (IE -> Internet Options / Advanced / Security):    . Check for publisher's certificate revocation    . Check for server ce…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

861 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