-2

I have got an error in running this query in phpMyadmin. The query is to update a table using inner join .Pls help me

My tables are :

userpswd

  • ID
  • password
  • Name
  • Col 4
  • Col 5
  • index
  • oncampus_present ( the colum I want to update )

oncampus

  • index
  • ID

I already have gone through most of the threads given here regarding the same and none seem to work.

UPDATE userpswd
SET oncampus_present='yes'
FROM userpswd
INNER JOIN oncampus
ON userpswd.ID=oncampus.ID
WHERE userpswd.oncampus_present=NULL
Dharman
  • 30,962
  • 25
  • 85
  • 135
  • #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'FROM userpswd INNER JOIN oncampus ON userpswd.ID=oncam' at line 3 – Param Bhatt Jun 03 '19 at 13:31
  • That error message SHOULD have been posted in your question before pressing the Ask button – RiggsFolly Jun 03 '19 at 13:43

1 Answers1

0

You have an error in your SQL syntax

Try This

UPDATE userpswd
INNER JOIN oncampus
ON userpswd.ID=oncampus.ID
SET oncampus_present='yes'
WHERE userpswd.oncampus_present IS NULL
Ali Ghaini
  • 882
  • 6
  • 13