Update values in the database Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of Update values in the database without wasting too much if your time.

The question is published on by Tutorial Guruji team.

I want to update the description in table b. In table a I have the newest data. I want to join on all the numbers that are available in table b and update the description. Only the numbers that are available in table b must be updated!

I have this query:

select * from b 
left join a.prod_nr = b.prod_nr

But how can i do an update to the fields? And how is the performance because there are updated 8000 rows.

I have table a

prod_nr description
1       test
2       things
3       pc

table b

prod_nr description
1       nothing
3       monitor

output after query in table b:

prod_nr description
1       test
3       pc

Answer

update b 
join a on a.prod_nr = b.prod_nr
set b.description = a.description
We are here to answer your question about Update values in the database - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji