List:General Discussion« Previous MessageNext Message »
From:Enrique Sanchez Vela Date:August 8 2005 12:29pm
Subject:Re: query - select from one, update another
View as plain text  
  
 


--- Gleb Paharenko <gleb.paharenko@stripped> wrote:

> Hello.
> 
> What about this:
> 
> UPDATE news
> SET comments =
> (
>   SELECT COUNT(id)
> 	FROM comments 
> 	WHERE newsid = news.id 
> 	GROUP BY newsid
> );  
> 
> 

Isn't the previous query going to update the
news.comments with the last count from the sub-query?



Enrique Sanchez Vela
email: esanchezvela@stripped
-----------------------------------------------------------------------------
It's often easier to fight for one's        ||    We live in the outer space              

principles than to live up to them        ||    Rev. Kay Greenleaf
Adlai Stevenson                                ||

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
Thread
query - select from one, update anotherSebastian8 Aug
  • Re: query - select from one, update anotherGleb Paharenko8 Aug
    • Re: query - select from one, update anotherEnrique Sanchez Vela8 Aug
      • Re: query - select from one, update anotherGleb Paharenko8 Aug
    • Re: query - select from one, update anotherSebastian8 Aug
      • Re: query - select from one, update anotherSGreen8 Aug
        • Re: query - select from one, update anotherNuno Pereira8 Aug
          • Re: query - select from one, update anotherSebastian8 Aug
            • Re: query - select from one, update anotherSGreen8 Aug
            • Re: query - select from one, update anotherNuno Pereira8 Aug
              • Re: query - select from one, update anotherSGreen8 Aug
        • Re: query - select from one, update anotherNuno Pereira8 Aug
      • Re: query - select from one, update anotherMichael Stassen8 Aug
        • Re: query - select from one, update anotherJasper Bryant-Greene8 Aug
          • Re: query - select from one, update anotherMichael Stassen8 Aug