Try:

update my_table
set fieldname1 = Now(), Fieldname2 = :myVariable
where Fieldname3 is not null



On 10/28/13 11:06 AM, Neil Tompkins wrote:
Hi

If I have a update statement like

UPDATE MY_TABLE
SET FieldName1 = Now(), FieldName2 = :MyVariable
WHERE FieldName3 = 'Y'

How can I only update the FieldName2 field if the value of MyVariable is
NOT NULL ?

Thanks
Neil


--
Andy Wallace
iHOUSEweb, Inc.
awall...@ihouseweb.com
(866) 645-7700 ext 219
--
"Sometimes it pays to stay in bed on Monday, rather than spending the rest of the 
week debugging Monday's code."
- Christopher Thompson

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql

Reply via email to