View Single Post

   
  #4 (permalink)  
Old 02-28-2008, 11:28 AM
qwertycat@googlemail.com
 
Posts: n/a
Default Re: Is it possible to combine a SELECT and UPDATE in a single query

On Sep 28, 10:37 am, "Martijn Tonies"
<m.ton...@upscene.removethis.com> wrote:
> How about:
>
> UPDATE Servers SET Server_Connections_In_Use =
> Server_Connections_In_Use+1 WHERE Server_ID =
> (SELECT Server_ID WHERE
> Servers.Server_Connections_In_Use < Servers.Server_Max_Connections
> LIMIT 1)


Thanks but:

"There is one caveat: It is not currently possible to modify a table
and select from the same table in a subquery."
http://dev.mysql.com/tech-resources/...ubqueries.html

Reply With Quote