I want to update a table which has only two fields
test_set_id and plan_id
which i can get easily from this query
SELECT tp.plan_id
, r.release_id
FROM test_plan tp
, releases r
, test_run tr
, iteration i
WHERE tr.iteration_id = i.iteration_id
AND i.release_id = r.release_id
AND tr.plan_id = tp.plan_id
AND i.release_id = 1
GROUP BY plan_id
but when I run the following query, it is giving me an sql error.
UPDATE test_set_relation
SET test_set_id
, plan_id=
( SELECT tp.plan_id
, r.release_id
FROM test_plan tp
, releases r
, test_run tr
, iteration i
WHERE tr.iteration_id = i.iteration_id
AND i.release_id = r.release_id
AND tr.plan_id = tp.plan_id
AND i.release_id = 1
GROUP BY plan_id
)
How do I fix this issue?
You cannot assign multiple field values like that in SET.
This will throw the error
Incorrect syntax near ','.(this error message is from SQL Server) because the query is expected to have an assignment operator = next to the column name.Your query should be formulated something along this line. Without knowing how your tables are structured, it is not possible to formulate a valid UPDATE statement.
Usage:
SQL ServersyntaxUsage:
MySQLsyntax