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

  • SEARCH
  • Home
  • 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 7750011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:10:48+00:00 2026-06-01T11:10:48+00:00

What is wrong with the following PostgreSQL query? UPDATE project_project SET project_project.create_date = assignments.start_date

  • 0

What is wrong with the following PostgreSQL query?

UPDATE project_project SET  project_project.create_date = assignments.start_date  
FROM project_project
LEFT JOIN account_analytic_account ON account_analytic_account.id = project_project.analytic_account_id
LEFT JOIN assignments ON assignments.accounts_ref = account_analytic_account.id

gives

[SQL] UPDATE project_project SET  project_project.create_date = assignments.start_date  
FROM project_project
LEFT JOIN account_analytic_account ON account_analytic_account.id = project_project.analytic_account_id
LEFT JOIN assignments ON assignments.accounts_ref = account_analytic_account.id

[Err] ERROR:  table name "project_project" specified more than once

I tried,

UPDATE pp SET  pp.create_date = am.start_date  
FROM project_project as pp
LEFT JOIN account_analytic_account as aa ON aa.id = pp.analytic_account_id
LEFT JOIN assignments as am ON am.accounts_ref = aa.id

gives

[SQL] UPDATE pp SET  pp.create_date = am.start_date  
FROM project_project pp
LEFT JOIN account_analytic_account aa ON aa.id = pp.analytic_account_id
LEFT JOIN am ON am.accounts_ref = aa.account_analytic_account.id

[Err] ERROR:  relation "pp" does not exist
LINE 1: UPDATE pp SET  pp.create_date = am.start_date  

What is the correct syntax?

  • 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-06-01T11:10:50+00:00Added an answer on June 1, 2026 at 11:10 am

    There are two problems to avoid:

    1- in SET column=value, do not prepend a table name or alias to column. It yields an error and is useless anyway, since UPDATE tablename is only able to update columns from tablename. An alias of tablename can be used in other places, but not in the SET clause.

    2- don’t repeat the name of the table to update in the rest of the query unless you want to specifically induce a secondary and uncorrelated scan of this table.

    Here is my proposal of a modified query that I hope does what you intend:

    UPDATE project_project pp SET create_date =
     (select assignments.start_date  FROM account_analytic_account LEFT JOIN assignments
      ON assignments.accounts_ref = account_analytic_account.id
     WHERE 
     account_analytic_account.id = pp.analytic_account_id);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following query: SELECT table_a.field1, table_b.field1 FROM table_a, table_c LEFT JOIN table_b
Is the following method wrong way of declaring namespace in Javascript? It is from
I have the following UPDATE statement: update mytable set a = first_part(genid()), b =
I am trying to query data from my app, through postgresql DB. What I
What's wrong with the following Postgres query? INSERT INTO kayak.airports(name, x, y, city) VALUES(
What is wrong with the following ? DECLARE @ImageIDsToDelete TABLE ( xID INT, ImageID
What is wrong with the following line? <xsl:for-each select=//Node1/Node2/Node3 [.!='Primary' or .!='Secondary' ]> Trying
What could possibly go wrong with the following transaction if executed by concurrent users
I'm not sure what's wrong with the following setup. I have a View that
Can somebody please tell me what is wrong with the following pom.xml? i'm getting

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.