RE: NULL VALUE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have a feeling that 'Status' field may be the problem. The word Status is used by MySQL for other sql commands. Either place the fieldname in backticks (the key under the ESC key) like so:

UPDATE `EMPLOYEE` SET `STATUS`='Inactive' where `STATUS` != 'Active';

or change the fieldname to emp_status or something like that.

The additional benefit of changing the name is to be able to link it quickly to the table that the field comes from emp_status from employees table and so on.

Also, set the default value for these types of columns. ( Note: to save db space, use 1 for Active and 0 for Inactive)

Bastien


From: "Perry, Matthew (Fire Marshal's Office)" <Matthew.Perry@xxxxxxxxxxxx>
To: php-db@xxxxxxxxxxxxx
Subject:  NULL VALUE
Date: Mon, 3 Jan 2005 11:40:52 -0600

My "status" column in my Employee table should have two values "Active" and
"Inactive".  Right now all the active employees have the value "Active" and
the rest have a NULL value.



Why is it that the following commands do nothing?

UPDATE EMPLOYEE SET STATUS='Inactive' where STATUS != 'Active';

UPDATE EMPLOYEE SET STATUS='Inactive' where STATUS <> 'Active';

UPDATE EMPLOYEE SET STATUS='Inactive' where STATUS IS NULL';

UPDATE EMPLOYEE SET STATUS='Inactive' where STATUS = '';

UPDATE EMPLOYEE SET STATUS='Inactive' where STATUS = NULL;



- Matthew
















-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux