Skip site navigation (1) Skip section navigation (2)

Re: Simple SQL-syntax

From: "Jeff Eckermann" <jeckermann(at)verio(dot)net>
To: "Fredrik Thunberg" <fredrik(at)datessa(dot)se>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Simple SQL-syntax
Date: 2001-08-20 14:29:21
Message-ID: 01af01c12984$80c48830$279c10ac@INTERNAL (view raw or flat)
Thread:
Lists: pgsql-sql
UPDATE TableA SET nrA = TableB.nrB WHERE nrA = TableB.nrA;

UPDATE statements don't take FROM clauses.  I don't think they like aliasing, either.
  ----- Original Message ----- 
  From: Fredrik Thunberg 
  To: pgsql-sql(at)postgresql(dot)org 
  Sent: Monday, August 20, 2001 6:15 AM
  Subject: Simple SQL-syntax


  Hello.

  I have a very simple sql-question from an sql-beginner:

  Suppose I have Table A looking something like this:

  Index    Text    NrA

  And Table B like this:

  NrA    NrB

  Then I want to change all occurences of NrA in Table A to NrB...

  I've tried:

  UPDATE tableA Set tableA.nrA = B.nrB From tableB B Where tableA.nrA = B.nrA;

  But that doesn't seem to work...

  Best regards

  /Fredrik Thunberg

In response to

pgsql-sql by date

Next:From: Jean-Christophe BoggioDate: 2001-08-20 14:51:33
Subject: Strange DISTINCT !
Previous:From: Raymond ChuiDate: 2001-08-20 14:08:36
Subject: How to execute a system file in procedure?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group