Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 VIDEO STORE

Author  Topic 

craigsql
Starting Member

6 Posts

Posted - 2009-07-07 : 19:13:13
Video Store
I am trying to write an SQL for a Video Store which will have a CheckOutDate & ReturnDate. I would need the difference in DAYS. The difference has to equal or be greater than 7 days which would indicate that a Movie is overdue.

After finding the datediff I need to multiply that number by $0.75.


Example: I have 3 tables that will be needed:

1. The Customer Table will hold the CardID.
2. The CheckOut Table will hold the ReturnDate & CheckOutDate
3. The Payment Table will hold Amount (indicates a payment for one Movie)



This is what I came close with. Still need a shove in the right direction. Thanks again for the help.



DECLARE @ReturnDate DATETIME
DECLARE @CheckOutDate DATETIME

SET @ReturnDate = @ReturnDate
SET @CheckoutDate = @CheckOutDate

SELECT datediff(Day, @ReturnDate, @CheckOutDate)

AS

[DATEDIFFERENCE]

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-07-08 : 01:42:55
So it is alway a good idea to give:
table structure
some sample data
wanted output

Fred


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-07-08 : 01:49:54
continued over http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=128917


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -