Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ctfeh-0003v4-E3 for pgsql-sql@arkaria.postgresql.org; Thu, 30 Mar 2017 19:22:47 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1ctfeg-0002gK-PG for pgsql-sql@arkaria.postgresql.org; Thu, 30 Mar 2017 19:22:46 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ctfef-0002fX-Ra for pgsql-sql@postgresql.org; Thu, 30 Mar 2017 19:22:46 +0000 Received: from mx1.gogca.com ([50.116.54.212]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ctfed-0003gh-Ds for pgsql-sql@postgresql.org; Thu, 30 Mar 2017 19:22:44 +0000 Received: from websrv.gogca.com (websrv.gogca.com [66.228.32.76]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.gogca.com (Postfix) with ESMTPSA id A00481C53B for ; Thu, 30 Mar 2017 15:22:12 -0400 (EDT) Date: Thu, 30 Mar 2017 15:22:12 -0400 (EDT) From: Gary Chambers To: PostgreSQL SQL Mailing List Subject: Re: Query Advice In-Reply-To: Message-ID: References: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org Gentlemen, Thank you for your replies. I'm working on a Python Flask web application. > To comment as to "better" without any knowledge of the "application layer" > doesn't make sense. I suggest you provide an example of what you'd like > the output to look like independent of any query concerns. "Better" is to have the results returned without having the address columns delimited by some character. The simple join that Jason suggested is definitely sufficient, but it seems like returning the repeating name column is unnecessary. My question is really more theoretical than anything else. Vincent's suggestion to return JSON is probably the closest to what I am trying to accomplish. My ultimate goal is to have the equivalent of a Python list of dictionaries as addresses, though the keys aren't a requirement as long as I can define the order of the columns and avoid using the delimiter. That being said, how would I accomplish this and return the data in the usual SQL results format without using concat_ws()? Thank you, again, for your advice. -- G. -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql