--- 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 another | Sebastian | 8 Aug |
| • Re: query - select from one, update another | Gleb Paharenko | 8 Aug |
| • Re: query - select from one, update another | Enrique Sanchez Vela | 8 Aug |
| • Re: query - select from one, update another | Gleb Paharenko | 8 Aug |
| • Re: query - select from one, update another | Sebastian | 8 Aug |
| • Re: query - select from one, update another | SGreen | 8 Aug |
| • Re: query - select from one, update another | Nuno Pereira | 8 Aug |
| • Re: query - select from one, update another | Sebastian | 8 Aug |
| • Re: query - select from one, update another | SGreen | 8 Aug |
| • Re: query - select from one, update another | Nuno Pereira | 8 Aug |
| • Re: query - select from one, update another | SGreen | 8 Aug |
| • Re: query - select from one, update another | Nuno Pereira | 8 Aug |
| • Re: query - select from one, update another | Michael Stassen | 8 Aug |
| • Re: query - select from one, update another | Jasper Bryant-Greene | 8 Aug |
| • Re: query - select from one, update another | Michael Stassen | 8 Aug |