mysql - Update table if conditions met. (update the value from table b to a) corresponding value required -


i have table in have fields 'date', 'time', cost , order_id

table b has fields 'year' 'month' 'hour' 'cost' , order_id fields.

both tables linked "order_id" field. want update table if year, month, hour , order_id same in both tables , update corresponding value table b table field "cost"

i have used statement, query not working? wrong in it? need help

update item a, cost b     set a.cost = b.cost     a.order_id = b.order_id     , year(a.date) = b.year     , month(a.date) = b.month     , hour(a.time) = b.hour 

update item join cost b on a.order_id = b.order_id            , year(a.date) = b.year            , month(a.date) = b.month            , hour(a.time) = b.hour set a.cost = b.cost 

Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

how to prompt save As Box in Excel Interlop c# MVC 4 -

xslt 1.0 - How to access or retrieve mets content of an item from another item? -