insert into select on duplicate mysql query -


i trying update on duplicate record in mysql,

i have table many column want update column table same desc current table not updating records.

my query is:

insert backup_prochart.symbol_list(ticker,end_date,cur_date) select ticker,t.end_date,t.cur_date prochart.symbol_list t ticker=t.ticker , ticker= 'may17' on duplicate key update end_date=t.end_date,cur_date=t.cur_date;

another query tried

insert backup_prochart.symbol_list(ticker,end_date,cur_date) select t.ticker,t.end_date,t.cur_date prochart.symbol_list t ticker=t.ticker , t.ticker= 'may17' on duplicate key update end_date=t.end_date,cur_date=t.cur_date;

can tell me whats wrong query.?

you try :

insert backup_prochart.symbol_list (ticker, end_date, cur_date)  select ticker, end_date, cur_date prochart.symbol_list ticker = 'may17'  on duplicate key update end_date = values(end_date), cur_date = values(cur_date); 

of course column "ticker" must defined unique table "backup_prochart.symbol_list".


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

.htaccess - ERR_TOO_MANY_REDIRECTS htaccess -