0

I have 2 tables.

Table 1 named: Users

Rows:

  • Name_Users
  • Age
  • Data
  • Email

Table 2 named: Data

Rows:

  • Name_Data
  • Data1
  • Data2
  • Data3

I need UPDATE the row Data on Users with the Data3 of table Data when on table Data the row Data1 = YES To the username with the Data1 = Yes.

I have this:

UPDATE Users JOIN Data ON Data1 = 'Yes' SET Data = Data3 WHERE Name_Data = Name_Users

I try others but nothing work, Is possible do it?, thanks

LorenaKING
  • 53
  • 6

1 Answers1

1

i think you sql will be like below

   UPDATE Users u
   JOIN Data d ON d.Name_Data = u.Name_Users and d.Data1 = 'Yes' 
   SET u.Data = d.Data3 
Zaynul Abadin Tuhin
  • 31,407
  • 5
  • 33
  • 63