...

View Full Version : How do I add an index when adding a new field?



jeddi
03-15-2009, 03:16 PM
Hi,

I would like to add an index as well as the new field.

I tried this, but it failed:



$sql = "ALTER TABLE `clients` ADD `new` char(1) NOT NULL default 'y',
KEY `new` (`new`)";

$result = mysql_query($sql)
or die("could not ALTER clients.". mysql_error());


Can anyone please help me get it right?
Thanks

djm0219
03-15-2009, 03:44 PM
ALTER TABLE `clients` ADD `new` char(1) NOT NULL default 'y' , ADD INDEX ( new)

jeddi
03-15-2009, 04:40 PM
Thanks for help :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum