Re: How to write such a query

Поиск
Список
Период
Сортировка
От Jonathan Strong
Тема Re: How to write such a query
Дата
Msg-id CAK8Y=HV826Qw-1tPNOZwCnz+sNqYio8tvGDFW+4jPwL4NRDfKg@mail.gmail.com
обсуждение исходный текст
Ответ на How to write such a query  (Igor Korot <ikorot01@gmail.com>)
Ответы Re: How to write such a query  (Igor Korot <ikorot01@gmail.com>)
Список pgsql-general
Are you looking to arbitrarily update the field in the fifth row, or can the row that needs to be updated be isolated by some add'l attribute? What's the use case?

- Jon

    

Jonathan Strong

CIO / CTO / Consultant

P: 609-532-1715 E: jonathanrstrong@gmail.com

Quora Top Writer



On Fri, Sep 18, 2020 at 1:27 PM 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.


В списке pgsql-general по дате отправления:

Предыдущее
От: Igor Korot
Дата:
Сообщение: How to write such a query
Следующее
От: Paul Förster
Дата:
Сообщение: Re: How to write such a query