mysql - Column 'Hits' in field list is ambiguous -


i got sql code can not work:

insert t_ruleid(logdate,month,hour,ruleid,hits,host,cdn_id) select b.logdate,b.month,b.hour,b.ruleid,b.hits,b.host,b.cdn_id t_ruleid_back b on duplicate key update hits=hits+b.hits; 

it got error column 'hits' in field list ambiguous

how can make work?

thanks!

normally, use values() value of passed in:

insert t_ruleid(logdate, month, hour, ruleid, hits, host, cdn_id)     select b.logdate, b.month, b.hour, b.ruleid, b.hits, b.host, b.cdn_id     t_ruleid_back b     on duplicate key update hits = hits + values(hits); 

i'm not sure b.hits generate specific error though.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -