Re: How to write such a query

From: Paul Förster <paul(dot)foerster(at)gmail(dot)com>
To: Igor Korot <ikorot01(at)gmail(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: How to write such a query
Date: 2020-09-18 17:34:39
Message-ID: 22B47033-D599-4FFE-8FB3-28532626FD95@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Igor,

> On 18. Sep, 2020, at 19:29, Igor Korot <ikorot01(at)gmail(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Igor Korot 2020-09-18 17:43:19 Re: How to write such a query
Previous Message Jonathan Strong 2020-09-18 17:33:56 Re: How to write such a query