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.
| Author |
Topic |
|
craigsql
Starting Member
6 Posts |
Posted - 2009-07-07 : 19:13:13
|
| Video StoreI 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 & CheckOutDate3. 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 DATETIMEDECLARE @CheckOutDate DATETIMESET @ReturnDate = @ReturnDateSET @CheckoutDate = @CheckOutDateSELECT 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 structuresome sample datawanted outputFred No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
|
|
|
|