MySQL Unknown Column Error 1054 Simple Update -
using mysql workbench, i'm getting odd behavior when attempting execute following statement:
update jobs set customer = 'ben' po = 1011;
the output of is: error code: 1054. unknown column 'jobs.po' in 'where clause'
the goal here update statement, or equivalent, execute. can't determine issue. what's particularly odd following statements:
select * jobs; select po jobs; select * jobs po = 1011; select po jobs po = 1011;
all function expected. specifically, no errors, returns , displays entries asked for. why might select execute without 1054 error when update can't?
the create table statement (if it's helpful), executed sql script through workbench:
create table `jobs` ( po mediumint not null, part tinyint unsigned not null default 1, `last dash` smallint unsigned not null default 0, customer varchar(80), description varchar(350), completed date, notes varchar(350), constraint pkjobs primary key (po, part) );
edit:: perhaps not simple construed. there exists 'before update' trigger on table.
delimiter // drop trigger if exists jobsup // create trigger jobsup before update on jobs each row begin if new.`last dash` < (select max(dash) tracking t new.po = t.po , new.part = t.part ) signal sqlstate '45000' set message_text = 'cannot update last dash value less assigned dash.'; end if; end // delimiter ;
figured out. database operating previous definition of jobsup trigger did not utilize 'new' keyword. recreating trigger solved issue.
Comments
Post a Comment