Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kJKHY-0003af-MH for pgsql-general@arkaria.postgresql.org; Fri, 18 Sep 2020 17:34:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kJKHX-0005Nr-5P for pgsql-general@arkaria.postgresql.org; Fri, 18 Sep 2020 17:34:47 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kJKHW-0005Nk-UX for pgsql-general@lists.postgresql.org; Fri, 18 Sep 2020 17:34:46 +0000 Received: from mail-ed1-x543.google.com ([2a00:1450:4864:20::543]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kJKHS-0001jw-KX for pgsql-general@lists.postgresql.org; Fri, 18 Sep 2020 17:34:46 +0000 Received: by mail-ed1-x543.google.com with SMTP id l17so6794190edq.12 for ; Fri, 18 Sep 2020 10:34:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=n3HJlXfrURt6/aiPnFstyYOqFXj5/S80lWe62p8IRwg=; b=Jat/iPJ0/Vx0c3mbyam3gyVwjGHHBJILJS5p7kggFPCCLGv0pfID1u6ZlM5NtBRyR4 Pl6THKTb2zJu2ux0fG2c9KbKWhFw5f4PSxYUfPoFwTPBnLFt8ry4TPcWjb8ECtfzsADR 7CeygA0qcplLUz2CwIlsK5MmWkdRIlmZK+B9PdbKx7DChB6xQZNKy2L2MOkYFc8VHH4q lsn8H5sWB/g1qTlZzAZ2t1XRdF9tz/IB0xBirGU/JL4nABy5EYpizYVt+ehnRovcijDY lKFeuJwBuD3VX0Hx67fHaF4p1oblNh7X7iQoiYSlwLPDDmtAIZp5V5X1sP4Mu24HUMyV 2VyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=n3HJlXfrURt6/aiPnFstyYOqFXj5/S80lWe62p8IRwg=; b=ZFXkbG4efegfGJhG0KWiEfltf1vKBr38203QmMZoHjq3EstCVE0YXEqdoz9GxhG5Xs HIlFiiFOkWir4kmVLCleM4jZNiXGn354MXxoEu99S7uHnM0xzjjD6REF117kbbXULosm FJoFsdWRsPa4AaCLsEXzvslligG1EZhLL4y3ABQ60S1MalypEgxL8FS2I3EvLVxw/Tcz it/Pqi5zXAAgwGAL1eE1cgsg6ILqrFMREuTaKpyxyzzu8+MGitfXtO2/ksZRi/fWahbN 92AFmgCtdoP/HfzVx0z2le5MzvmlLZf36QzmtD+4/G+ZFVt2aY8J0sfn2p6KLqk54iwA ozTg== X-Gm-Message-State: AOAM5315X+QFHCfGChFeNFGucc3CgStUUkQO3Qm4uc1AUD4/IHxYNqN+ +hdxq+8m6jy97v0zbFMmuLM= X-Google-Smtp-Source: ABdhPJyWJGKBkkUawdh71P9NA2JED+n9Yn0dKSQiJviE0RTcWxuEBLFx5rJ2dFST9f4CNtWpiZcoww== X-Received: by 2002:a05:6402:7d2:: with SMTP id u18mr40228605edy.69.1600450481967; Fri, 18 Sep 2020 10:34:41 -0700 (PDT) Received: from [192.168.1.8] (241-57-239-77.dyn.cable.fcom.ch. [77.239.57.241]) by smtp.gmail.com with ESMTPSA id j15sm2647048eds.33.2020.09.18.10.34.41 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Sep 2020 10:34:41 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.1\)) Subject: Re: How to write such a query From: =?utf-8?Q?Paul_F=C3=B6rster?= In-Reply-To: Date: Fri, 18 Sep 2020 19:34:39 +0200 Cc: pgsql-general@lists.postgresql.org Content-Transfer-Encoding: 7bit Message-Id: <22B47033-D599-4FFE-8FB3-28532626FD95@gmail.com> References: To: Igor Korot X-Mailer: Apple Mail (2.3608.120.23.2.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi Igor, > On 18. Sep, 2020, at 19:29, Igor Korot 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 = '' WHERE.... > [/code] > > Thank you. update x set field1='' where id=5; Cheers, Paul