Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fUf9v-0003Fe-HU for pgsql-general@arkaria.postgresql.org; Sun, 17 Jun 2018 21:24:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fUf9r-0006pJ-I2 for pgsql-general@arkaria.postgresql.org; Sun, 17 Jun 2018 21:24:23 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fUdD6-0002Cg-Tb for pgsql-general@lists.postgresql.org; Sun, 17 Jun 2018 19:19:36 +0000 Received: from n3.nabble.com ([162.255.23.22]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fUdD3-0004Lv-Qz for pgsql-general@postgresql.org; Sun, 17 Jun 2018 19:19:36 +0000 Received: from n3.nabble.com (localhost [127.0.0.1]) by n3.nabble.com (Postfix) with ESMTP id 78BFBD839753 for ; Sun, 17 Jun 2018 12:19:31 -0700 (MST) Date: Sun, 17 Jun 2018 12:19:31 -0700 (MST) From: Rv02 To: pgsql-general@postgresql.org Message-ID: <1529263171492-0.post@n3.nabble.com> Subject: Check to see if customer exist in second table. Help needs with psql MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk psql I have two tables , table A and Table b. Table A has list of about 60000 customers ID with all their details and Table B had customer is and age for over 500000 rows of customers. I need a query that will take a customer from table a and if that customer exists in table B then insert a yes in a new column in table a. Basically what I want to end up with in table a , is all the customers in this table and if they exist in table B then yes in a column. I.e the final result will be 60000 customers and additional column at the end with yes or no depending if they exist in table B. Any help is appreciate it -- Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html