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: 201
this is what i am doing
update t1 set x=a,y=b where a and b are obtained from (select query here)
- i know the select query
- the select query returns multiple results which are the same
- when i use group by or distinct query execution slows down considerably
- a and b are forward references so mysql reports an error
- 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