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
 Date Calculations.. please help!

Author  Topic 

Pam_w
Starting Member

1 Post

Posted - 2005-11-25 : 06:57:40
Hello,

I am a student and I have an assignment in for next week and we are having a few problems... below is some code we have created to enter in payment details for a customer....

INSERT into Payments values(Payments_seq.nextval, initcap('&Payment_Method'), '&Amount_Payable',
Date_Due = (select date_of_order from orders where order_no = (date_of_order+7));

I am having trouble with the last line, I want the date due to be calculated from the date the order was made in another table (orders) and I want a week to be added to this so that in the field it will display (date ordered plus 7 days)...

Any help you can give would be great, I've only been using isql plus for about 4 weeks...

Thanks

Pam :)

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2005-11-25 : 07:51:49
use dateadd(day, 7, date_of_order)

-----------------
[KH]
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-11-25 : 08:24:27
>>(select date_of_order from orders where order_no = (date_of_order+7));

Do you want to get Order_no whose date_of_order is date_of_order+7?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -