Using v4.0.15 on WinNT under Apache.
For my sins, the client has insisted on creating a page counter!
The fields are to be CounterCode (Varchar 10), CounterValue (Int 10) and
CounterStartDateTime (DateTime).
Setting up the table is no problem. However, client wants to have the
UPDATE Table SET CounterValue = CounterValue+1, CounterStartDateTime =
(IF CounterStartDateTime IS NULL, Now())
without success.
It looks like you just have the syntax wrong. Try:
UPDATE Table SET CounterValue = CounterValue+1, CounterStartDateTime =
IF(CounterStartDateTime IS NULL,
.
...
etc.
Just my two cents worth
Rhino
- Original Message -
From: Terry Riley [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, March 09, 2004 12:11 PM
Subject: Update field conditionally
Using v4.0.15 on WinNT under Apache.
For my sins, the client has insisted on creating a page
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
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
Message -
From: Terry Riley [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, March 09, 2004 12:11 PM
Subject: Update field conditionally
Using v4.0.15 on WinNT under Apache.
For my sins, the client has insisted on creating a page counter!
The fields are to be CounterCode
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), CounterValue
Hello Terry,
Tuesday, March 9, 2004, 6:25:00 PM, you wrote:
TR Good point, Richard. I was perhaps in a little bit too much of a hurry
TR putting that together, and didn't even consider that!
No worries. One other thought that occurred to me that might help with
the original problem is as
Hello Terry,
Tuesday, March 9, 2004, 6:25:00 PM, you wrote:
TR Good point, Richard. I was perhaps in a little bit too much of a
hurry
TR putting that together, and didn't even consider that!
No worries. One other thought that occurred to me that might help with
the original