Jump to content

Simple UPDATE question


Darkmatter5

Recommended Posts

Here's my UPDATE:

UPDATE byrnjobdb.employees SET address, city, zip_code, home_phone, active_employee, lic_rpls, lic_pe='123', 'Kingsbury', '78638', '555-555-5555', 'Yes', 'No', 'No' WHERE employee_id=7

 

If my table is like this:

CREATE TABLE `employees` (
  `employee_id` int(11) NOT NULL auto_increment,
  `first_name` varchar(50) NOT NULL,
  `last_name` varchar(50) NOT NULL,
  `address` varchar(50) default NULL,
  `city` varchar(50) default NULL,
  `state_id` int(11) default NULL,
  `zip_code` varchar(10) default NULL,
  `home_phone` varchar(12) default NULL,
  `cell_phone` varchar(12) default NULL,
  `active_employee` enum('No','Yes') NOT NULL default 'Yes',
  `lic_rpls` enum('No','Yes') NOT NULL default 'No',
  `lic_pe` enum('No','Yes') NOT NULL default 'No',
  PRIMARY KEY  (`employee_id`),
  KEY `fk_state_id` (`state_id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1;

 

Why am I getting the following error:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' city, zip_code, home_phone, active_employee, lic_rpls, lic_pe='123', 'Kingsbury' at line 1 

 

Thanks!

Link to comment
Share on other sites

Don't you need to set address, city, zip_code, etc, to a value? Like this:

 

UPDATE byrnjobdb.employees SET address='123', city='Kingsbury', zip_code='78638', home_phone='555-555-5555', active_employee='Yes', lic_rpls='No', lic_pe='No' WHERE employee_id=7

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.