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
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Follow-up To:
Add Cc | Add Follow-up to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers that you hear
 
mich  
View profile   Translate to Translated (View Original)
 More options 3 July, 20:58
From: mich <michaile...@gmail.com>
Date: Fri, 3 Jul 2009 12:58:30 -0700 (PDT)
Local: Fri 3 July 2009 20:58
Subject: Help me write subquery in update query
I want to execute such sql:

update blog_entry set comment_number = (select count(*) from
blog_comment where blog_comment.root = blog_entry.id)

How I can write such query in DQL? I tried:

        $q = Doctrine_Query::create()
            ->update('Blog_Entry Entry')
            ->set('Entry.comment_number', '(SELECT COUNT(Comment.id)
FROM Entry.Blog_Comment Comment WHERE Comment.root = Entry.id)')
            ->execute()
        ;

but it throws exception "Unknown component alias Comment".


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

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