Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3842628
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T15:49:16+00:00 2026-05-19T15:49:16+00:00

Basically I am trying to execute this query UPDATE communication_relevance SET score = (SELECT

  • 0

Basically I am trying to execute this query

UPDATE communication_relevance SET score = (SELECT ((ces.EXPERT_SCORE * cirm.CONSUMER_RATING) + (12.5 * scs.SIMILARITY)* (1 - EXP(-0.5 * (cal.TIPS_AMOUNT / AT.AVG_TIPS)) + .15))AS ANSWER_SCORE
FROM COMMUNICATION_RELEVANCE AS cr
JOIN network_communications AS nc
ON cr.COMMUNICATION_ID=nc.COMMUNICATIONS_ID
JOIN consumer_action_log AS cal
ON cr.ACTION_LOG_ID=cal.ACTION_LOG_ID
JOIN communication_interest_mapping AS cim
ON nc.PARENT_COMMUNICATIONS_ID=cim.COMMUNICATION_ID
JOIN consumer_interest_rating_mapping AS cirm
ON cr.CONSUMER_ID=cirm.CONSUMER_ID
    AND cim.CONSUMER_INTEREST_EXPERT_ID=cirm.CONSUMER_INTEREST_ID
JOIN consumer_expert_score AS ces
ON nc.SENDER_CONSUMER_ID=ces.CONSUMER_ID
    AND cim.CONSUMER_INTEREST_EXPERT_ID=CONSUMER_EXPERT_ID
JOIN survey_customer_similarity AS scs
ON cr.CONSUMER_ID=scs.CONSUMER_ID_2
    AND cal.SENDER_CONSUMER_ID=scs.CONSUMER_ID_1 
OR cr.CONSUMER_ID=scs.CONSUMER_ID_1
    AND cal.SENDER_CONSUMER_ID=scs.CONSUMER_ID_2
CROSS JOIN
(SELECT AVG(TIPS_AMOUNT) AS AVG_TIPS
FROM CONSUMER_ACTION_LOG
JOIN COMMUNICATION_RELEVANCE
ON CONSUMER_ACTION_LOG.SENDER_CONSUMER_ID=COMMUNICATION_RElEVANCE.consumer_id) AT)
;

But I get this error:

Error:1/25/2011 1:03:20 PM 0:00:00.135: Lookup Error - MySQL Database Error: You can't specify target table 'communication_relevance' for update in FROM clause

Any help would be much appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T15:49:16+00:00Added an answer on May 19, 2026 at 3:49 pm

    You an use UPDATE (.. JOIN ..) SET syntax

    UPDATE communication_relevance X
    JOIN (
        SELECT cr.COMMUNICATION_ID, ((ces.EXPERT_SCORE * cirm.CONSUMER_RATING)
            + (12.5 * scs.SIMILARITY)
            * (1 - EXP(-0.5 * (cal.TIPS_AMOUNT / AT.AVG_TIPS)) + .15)) AS ANSWER_SCORE
        FROM COMMUNICATION_RELEVANCE AS cr
        JOIN network_communications AS nc ON cr.COMMUNICATION_ID=nc.COMMUNICATIONS_ID
        JOIN consumer_action_log AS cal ON cr.ACTION_LOG_ID=cal.ACTION_LOG_ID
        JOIN communication_interest_mapping AS cim ON nc.PARENT_COMMUNICATIONS_ID=cim.COMMUNICATION_ID
        JOIN consumer_interest_rating_mapping AS cirm ON cr.CONSUMER_ID=cirm.CONSUMER_ID
            AND cim.CONSUMER_INTEREST_EXPERT_ID=cirm.CONSUMER_INTEREST_ID 
        JOIN consumer_expert_score AS ces ON nc.SENDER_CONSUMER_ID=ces.CONSUMER_ID
            AND cim.CONSUMER_INTEREST_EXPERT_ID=CONSUMER_EXPERT_ID
        JOIN survey_customer_similarity AS scs ON
            cr.CONSUMER_ID=scs.CONSUMER_ID_2 AND cal.SENDER_CONSUMER_ID=scs.CONSUMER_ID_1 
         OR cr.CONSUMER_ID=scs.CONSUMER_ID_1 AND cal.SENDER_CONSUMER_ID=scs.CONSUMER_ID_2
        CROSS JOIN
        (
            SELECT AVG(L.TIPS_AMOUNT) AS AVG_TIPS
            FROM CONSUMER_ACTION_LOG L
            JOIN COMMUNICATION_RELEVANCE R ON L.SENDER_CONSUMER_ID=R.consumer_id
        ) AT
    ) ON X.COMMUNICATION_ID = AT.COMMUNICATION_ID
    SET X.score = AT.ANSWER_SCORE;
    

    As a proof of concept for anyone else reading this, here is a table you can create and try the syntax on

    create table user_news(
        user_id int, article_id int, article_date timestamp,
        primary key(user_id, article_id));
    insert into user_news select 1,2,'2010-01-02';
    insert into user_news select 1,3,'2010-01-03';
    insert into user_news select 1,4,'2010-01-01';
    insert into user_news select 2,1,'2010-01-01';
    insert into user_news select 2,2,'2010-01-02';
    insert into user_news select 2,3,'2010-01-02';
    insert into user_news select 2,4,'2010-01-02';
    insert into user_news select 4,5,'2010-01-05';
    

    Now run the update (it sets the article_date of all records to the MAX article_date from the same user)

    update user_news a
    join (
      select b.user_id, max(b.article_date) adate
      from user_news b
      group by b.user_id) c
      on a.user_id=c.user_id
    set a.article_date = c.adate;
    

    Finally, inspect the contents

    select * from user_news;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to execute a more or less advanced query with Mongoid that basically
I recently came across this in some code - basically someone trying to create
Im trying do this basically: var tr = document.createElement(tr); var td = document.createElement(td); td.appendChild(document.createTextNode('<input
I am trying to execute this function: public static int QueryInterface( IntPtr pUnk, ref
I'm basically trying to figure out the simplest way to perform your basic insert
I'm basically trying to teach myself how to code and I want to follow
Basically I am trying to restart a service from a php web page. Here
Basically I'm trying to accomplish the same thing that mailto:bgates@microsoft.com does in Internet Explorer
Basically I'm trying to change the Canvas.Left property of an Ellipse Silverlight control in
Basically I am trying to retrieve a list of stored procedure parameters using Linq

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.