Google Mail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion Help me write subquery in update query

View Parsed - Show only message text

MIME-Version: 1.0
Received: by 10.100.106.12 with SMTP id e12mr1479078anc.28.1246934251681; Mon, 
	06 Jul 2009 19:37:31 -0700 (PDT)
Date: Mon, 6 Jul 2009 19:37:31 -0700 (PDT)
In-Reply-To: <78f93abf-bd81-4c8d-92d6-20cd4bd4cf18@d4g2000yqa.googlegroups.com>
X-IP: 64.233.242.201
References: <bbf36b0f-479b-40ff-a0d7-6a49d82d7673@b9g2000yqm.googlegroups.com> 
	<78f93abf-bd81-4c8d-92d6-20cd4bd4cf18@d4g2000yqa.googlegroups.com>
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.11) 
	Gecko/2009060215 Firefox/3.0.11 (.NET CLR 3.5.30729),gzip(gfe),gzip(gfe)
Message-ID: <c3cd6ec7-4481-4732-a458-ca3b8ff9caca@26g2000yqk.googlegroups.com>
Subject: Re: Help me write subquery in update query
From: DerekP <derekrobertpr...@gmail.com>
To: doctrine-user <doctrine-user@googlegroups.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

http://www.doctrine-project.org/documentation/manual/1_1/en/dql-doctrine-qu=
ery-language:subqueries
only report subquery support in FROM, SELECT, and WHERE statements.
Maybe it just plain doesn't work in SET, yet?

Derek


On Jul 6, 3:23=C2=A0am, mich <michaile...@gmail.com> wrote:
> Anyone? What am I doing wrong?
>
> On 3 =D0=B8=D1=8E=D0=BB, 22:58, mich <michaile...@gmail.com> wrote:
>
> > I want to execute such sql:
>
> > update blog_entry set comment_number =3D (select count(*) from
> > blog_comment where blog_comment.root =3D blog_entry.id)
>
> > How I can write such query in DQL? I tried:
>
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 $q =3D Doctrine_Query::create()
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ->update('Blog_Entry Entry')
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ->set('Entry.comment_number',=
 '(SELECT COUNT(Comment.id)
> > FROM Entry.Blog_Comment Comment WHERE Comment.root =3D Entry.id)')
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ->execute()
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;
>

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google