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
 Old Forums
 CLOSED - General SQL Server
 simple sql expression (but not for me:( )

Author  Topic 

alec77
Starting Member

5 Posts

Posted - 2003-01-13 : 11:14:55
I have 3 tables: date, status, future date.
I want, for every month, "future date" is updated to the following month when date is more then the 21th of every month and when status is equal to 70%.
Example:

Date=22/01/2002
Status=70%
Future Date--> February
Thank you!

mr_mist
Grunnio

1870 Posts

Posted - 2003-01-13 : 11:51:09
UPDATE yourtable
SET [date] = dateadd (m, 1, [date])
where status = 70 and
day ([date]) > 21

?

-------
Moo.
Go to Top of Page

alec77
Starting Member

5 Posts

Posted - 2003-01-14 : 03:39:12
I have a little problem...
Where have I to insert the code?
Thanks...

Go to Top of Page

mr_mist
Grunnio

1870 Posts

Posted - 2003-01-14 : 03:43:25
quote:

I have a little problem...
Where have I to insert the code?
Thanks...





I'm not sure what you mean. Please explain the problem. You can run the code from Query Analyzer, or anything else that supports SQL...

-------
Moo.
Go to Top of Page

rihardh
Constraint Violating Yak Guru

307 Posts

Posted - 2003-01-14 : 03:48:05
Hey Alec77,

next time don't miss school skateboarding or whatever and do your homework alone!

Go to Top of Page

alec77
Starting Member

5 Posts

Posted - 2003-01-14 : 03:52:18
I mean, Have I to insert the code in properties-->event of the control "future date" or not?

Go to Top of Page

mr_mist
Grunnio

1870 Posts

Posted - 2003-01-14 : 03:59:55
Sorry I have no idea what a properties-->Event control is. I was labouring under the misconception that you had a problem with the SQL, not with some programming language.

-------
Moo.
Go to Top of Page

alec77
Starting Member

5 Posts

Posted - 2003-01-14 : 04:09:47
I try to explain again the problem.
I have 3 controls(date,status,future date) in a form(Access2000) and I want the control "future date" shows a value based on values of the controls date and status.

IF Date=22/01/2002 AND
Status=70%
Then Future Date--> February

I know I have to insert a code but I don't know where!
Please help me!
Very thanks!!!


Go to Top of Page

mr_mist
Grunnio

1870 Posts

Posted - 2003-01-14 : 04:17:58
Ok I do not know about this access form so I will let someone else answer it.

-------
Moo.
Go to Top of Page

rihardh
Constraint Violating Yak Guru

307 Posts

Posted - 2003-01-14 : 05:12:39
Oh man Alec77, you're really something!

For the sake of getting rid of your silly question:

PRESS Alt + F11

P.S.
This advice comes for free: READING BEFORE DOING!

Go to Top of Page
   

- Advertisement -