pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Paul Förster <paul.foerster@gmail.com>
To: Igor Korot <ikorot01@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: How to write such a query
Date: Fri, 18 Sep 2020 19:34:39 +0200
Message-ID: <22B47033-D599-4FFE-8FB3-28532626FD95@gmail.com> (raw)
In-Reply-To: <CA+FnnTzwZv4x8cuLWYBoOJecaXS1qFOaLPrkopF-LWkKoBNP1w@mail.gmail.com>
References: <CA+FnnTzwZv4x8cuLWYBoOJecaXS1qFOaLPrkopF-LWkKoBNP1w@mail.gmail.com>

Hi Igor,

> On 18. Sep, 2020, at 19:29, Igor Korot <ikorot01@gmail.com> wrote:
> 
> Hi,
> Consider following
> 
> [code]
> CREATE TABLE X(id INTEGER PRIMARY KEY, field1 char(50), field2 int);
> CREATE TABLE Y(id INTEGER PRIMARY KEY, field1 char, field2 double(10, 2));
> SELECT X.field1, Y.field2 from X, Y WHERE X.id = Y.id;
> [/code]
> 
> Assuming that the SELECT return 10 rows, I want to update X.field1
> in row 5.
> 
> How do I write a WHERE clause in the
> 
> [code]
> UPDATE X.field1 SET X.field1 = '<some_string>' WHERE....
> [/code]
> 
> Thank you.

update x set field1='<some string>' where id=5;

Cheers,
Paul





view thread (36+ messages)  latest in thread

Message-ID: <22B47033-D599-4FFE-8FB3-28532626FD95@gmail.com>
Permalink:  ../22B47033-D599-4FFE-8FB3-28532626FD95@gmail.com/
Also on:    postgresql.org/message-id/22B47033-D599-4FFE-8FB3-28532626FD95@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: paul.foerster@gmail.com, ikorot01@gmail.com
  Subject: Re: How to write such a query
  In-Reply-To: <22B47033-D599-4FFE-8FB3-28532626FD95@gmail.com>
  References: <CA+FnnTzwZv4x8cuLWYBoOJecaXS1qFOaLPrkopF-LWkKoBNP1w@mail.gmail.com> <22B47033-D599-4FFE-8FB3-28532626FD95@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox