| | |
ERROR 1093 (HY000): You can't specify target table
Please support our MySQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
Hi to xperts here,
I do not know how to update with the follwing requirement
as it shows error as
ERROR 1093 (HY000): You can't specify target table 'participation_score' for update in FROM clause.
I am stuck here and some help here would be great.. Not getting exactly what needs to be redone..
Regards
Harish
I do not know how to update with the follwing requirement
MySQL Syntax (Toggle Plain Text)
$score_update_query = "UPDATE participation_score SET score_last_update = '$date' , score = (IFNULL((SELECT avg(score)*0.8 FROM entity_score WHERE entity_score.contributor_id = contributor.contributor_id) , 4) + IFNULL((select participation_score*2 from participation_score where participation_score.contributor_id = contributor.contributor_id), 1) ) WHERE participation_score.user_id is null ; ";
as it shows error as
ERROR 1093 (HY000): You can't specify target table 'participation_score' for update in FROM clause.
I am stuck here and some help here would be great.. Not getting exactly what needs to be redone..
Regards
Harish
Last edited by peter_budo; Nov 10th, 2008 at 8:00 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
•
•
Join Date: Aug 2008
Posts: 1,162
Reputation:
Solved Threads: 138
you can't use a subquery on the table you are wanting to be updated
Custom Application & Software Development
www.houseshark.net
www.houseshark.net
•
•
Join Date: Aug 2008
Posts: 1,162
Reputation:
Solved Threads: 138
yes, find which results you need to update
then loop through the results and create the updates there instead of combining it
here is some pseudo code, something like
then loop through the results and create the updates there instead of combining it
here is some pseudo code, something like
MySQL Syntax (Toggle Plain Text)
SELECT * FROM participation_score WHERE user_id IS NULL foreach result { $score = //DO your calculation that you had, selecting on a participation_score_id //NOW UPDATE UPDATE participation_score SET //...... WHERE participation_score_id = }
Custom Application & Software Development
www.houseshark.net
www.houseshark.net
![]() |
Other Threads in the MySQL Forum
- Previous Thread: please help me using ssh (very urgent)
- Next Thread: How to search over 3 tables
| Thread Tools | Search this Thread |
Tag cloud for MySQL
"use" 1 agplv3 alfresco amazon api artisticlicense aws bizspark changingprices communityjournalism contentmanagement contractors copyright count crm data database design developer development distinct drupal dui ec2 eliminate email enter enterprise error facebook form foss gartner gnu government gpl greenit groklaw groupware hiring hyperic images innerjoins insert ip join journalism keyword kickfire laptop legal license licensing linux maintenance mariadb matchingcolumns metron micromanage microsoft microsoftexchange mindtouch montywidenius mozilla multiple mysql mysqlcolumnupdating mysqldatetimeordermax() mysqlinternalqueries mysqlquery mysqlsearch news open-xchange opendatabasealliance opengovernment opensource operand oracle pdf penelope php priceupdating query referencedesign remove saas search select sharepoint simpledb sourcecode spotify sql statement sugarcrm techsupport thunderbird update virtualization






