Reputation: 18926
This is what i am doing
update t1 set x=a,y=b where a and b are obtained from (select query here)
How can i achieve all this?
Upvotes: 0
Views: 1287
Reputation: 102438
LIMIT
specifies the number of rows to return from the beginning of the result set:
SELECT * FROM t2 LIMIT 1;
# Retrieve 1st row
LIMIT
in your case is applied in the subquery in your from
clause.
These linsk can help you out with update
that uses a subquery:
Upvotes: 1
Reputation: 48169
you might be looking for something like...
update T1, (select Sub1.a, Sub1.b from YourSubQueryTable Sub1 where ... ) SubResult
set T1.a = SubResult.a,
T1.b = SubResult.b
where
Some T1.Criteria To be applied
Upvotes: 0