0

I have 2 tables
Table child : sgl_id ,student_id, school_id , state
Table parent : sgl_id , school_id
Im trying to update child.state = 1 but...

UPDATE child
SET state = 1
WHERE sgl_id 
IN (
SELECT child.sgl_id
FROM child
LEFT JOIN parent ON child.sgl_id = parent.sgl_id
 AND child.school_id = parent.school_id
WHERE 1
AND parent.sgl_id IS NULL )
user35181
  • 3
  • 2
  • Please add DBMS tag, error message with this question. I think may be `WHERE 1` has the issue. you can try using `WHERE 1=1 AND...`. Or else you can check https://stackoverflow.com/questions/224732/sql-update-from-one-table-to-another-based-on-a-id-match link – Koushik Roy May 31 '21 at 05:07
  • [Why should I tag my DBMS](https://meta.stackoverflow.com/questions/388759/) –  May 31 '21 at 06:15

0 Answers0