Hi,
my table and query are as below.
I am trying to increment the sequence number but I get a failure because of a duplicate key error. I guess it is incrementing a 13 (say), to a 15, where it hasn;t yet incremented 15 to 17.
So what would the solution be please?
create table statement
CREATE TABLE dishes (
id bigint(20) NOT NULL auto_increment,
business_id int(11) NOT NULL,
content_category varchar(32) collate utf8_unicode_ci NOT NULL default 'Menus',
menu_name varchar(64) collate utf8_unicode_ci NOT NULL,
live_from date NOT NULL,
course varchar(32) collate utf8_unicode_ci NOT NULL,
dish varchar(255) collate utf8_unicode_ci NOT NULL default 't',
description text collate utf8_unicode_ci,
price varchar(64) collate utf8_unicode_ci default '0.00',
display_sequence int(2) unsigned zerofill NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY business_id_2 (business_id,content_category,menu_name,live_from,display_sequence),
KEY business_id (business_id,content_category,menu_name,live_from)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
here’s the query
update dishes
set display_sequence = display_sequence + 2
where business_id = 123
and content_category = 'Menus'
and menu_name = 'whatsit'
and live_from = '2010-11-01'
and display_sequence >= 05
bazz