Re: Update field conditionally

2004-03-09 Thread Terry Riley
See below: --Original Message- > Hello Terry, > > Tuesday, March 9, 2004, 5:11:00 PM, you wrote: > > I know you have some solutions to the original problem already, but I > just wanted to make one small observation: > > TR> The fields are to be CounterCode (Varchar 10), Count

Re: Update field conditionally

2004-03-09 Thread Terry Riley
See below: --Original Message- > If it was me writing the code, I'd use two different update statements: > > a) an UPDATE to initialize the DateTime to Now() and set the counter to > 1 > when the page is first hit > b) another UPDATE to increment the counter on all of the rema

Re: Update field conditionally

2004-03-09 Thread Richard Davey
Hello Terry, Tuesday, March 9, 2004, 5:11:00 PM, you wrote: I know you have some solutions to the original problem already, but I just wanted to make one small observation: TR> The fields are to be CounterCode (Varchar 10), CounterValue (Int 10) and TR> CounterStartDateTime (DateTime). Using a

Re: Update field conditionally

2004-03-09 Thread Terry Riley
Thanks, Jeremy What I actually needed was: UPDATE Table SET CounterValue = CounterValue+1, CounterStartDateTime = IF(CounterStartDateTime IS NULL, Now(), CounterStartDateTime) This prevents it going back to NULL if the value is already not NULL. Thanks again. Terry --Original Messa

Re: Update field conditionally

2004-03-09 Thread Rhino
If it was me writing the code, I'd use two different update statements: a) an UPDATE to initialize the DateTime to Now() and set the counter to 1 when the page is first hit b) another UPDATE to increment the counter on all of the remaining hits Something like this (assuming Java is your programmi