DO YOU NEED A CONTENT WRITER FOR YOUR BUSINESS?

Your One-Stop Solution for All Content Needs! Click here for more!
Categories: MySQL

Update from one table to another with condition in MySQL

Share

In MySQL, you can update fields of one table from another table with a conditional statement also.

For example, you have two tables i.e. “user_activity” and “user”. And you need to update a column in one table to the value of another column where an user_id matches in both tables.

So, in a single query you can update fields of one table from another table.

UPDATE user_activity, user
SET user_activity.company_id = user.company_id
WHERE  user_activity.user_id = user.user_id
Namaste UI

For any types of queries, you can contact us on info[at]namasteui.com.

Recent Posts

The Future of Cryptocurrency 100 Years From Now: Bold Predictions & Key Forces

Cryptocurrency has transformed from a digital experiment into a global financial force in just over…

1 day ago

Silent Layoffs in Indian Tech Sector: Subtle Signs Employees Shouldn’t Ignore

Introduction Layoffs have always been a part of corporate life, but the way they’re happening…

3 days ago

Moving Made Mindful: Car Shipping Tips That Align With Your Lifestyle

Relocating is often an exciting milestone, whether you’re starting a new job, heading to college,…

4 days ago

Do Keyword-Focused Domains Have Relevance for Voice Search Today?

When you select cheap domain names, it can have a significant impact on the success…

6 days ago

VPS Hosting for Resource-Intensive Applications: What You Need to Know

Shared hosting struggles to keep up the performance commitment. Therefore, low-cost VPS hosting is an…

6 days ago

How Dermatologists Treat Melasma Without Over-Bleaching the Skin

Does your melasma return every summer despite months of treatment? Melasma appears as brown or…

7 days ago