mysql reference result from subquery

Posted by iamrohitbanga on Stack Overflow See other posts from Stack Overflow or by iamrohitbanga
Published on 2010-03-13T15:46:24Z Indexed on 2010/03/13 15:55 UTC
Read the original article Hit count: 181

Filed under:
|

this is what i am doing

update t1 set x=a,y=b where a and b are obtained from (select query here)
  1. i know the select query
  2. the select query returns multiple results which are the same
  3. when i use group by or distinct query execution slows down considerably
  4. a and b are forward references so mysql reports an error
  5. i want to set a equal to the value obtained in the first row and b equal to the value obtained in the first row for the respective columns, to avoid group by. i don't know how to refer to the first result from the select query.

how can i achieve all this?

© Stack Overflow or respective owner

Related posts about mysql

Related posts about sql