Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ceWYs-0000Zu-9z for pgsql-sql@arkaria.postgresql.org; Fri, 17 Feb 2017 00:38:10 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1ceWYq-0001ZE-Pw for pgsql-sql@arkaria.postgresql.org; Fri, 17 Feb 2017 00:38:08 +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 1ceWXs-0000TQ-DJ for pgsql-sql@postgresql.org; Fri, 17 Feb 2017 00:37:08 +0000 Received: from mwork.nabble.com ([162.253.133.43]) by makus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ceWXp-00077Z-II for pgsql-sql@postgresql.org; Fri, 17 Feb 2017 00:37:07 +0000 Received: from mben.nabble.com (unknown [162.253.133.72]) by mwork.nabble.com (Postfix) with ESMTP id BEBB92D4DEE97 for ; Thu, 16 Feb 2017 17:37:04 -0700 (MST) Date: Thu, 16 Feb 2017 17:37:04 -0700 (MST) From: sqlQuestions To: pgsql-sql@postgresql.org Message-ID: <1487291824702-5944807.post@n3.nabble.com> In-Reply-To: References: <1487283597419-5944796.post@n3.nabble.com> <1487286348488-5944801.post@n3.nabble.com> Subject: Re: Conditional Lookup Table with Like MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -0.3 (/) 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 OK, it's very close I think. I created a Fiddle that more closely represents what I need with an added table. http://sqlfiddle.com/#!15/5d76f/6 It's showing a few too many records and GROUP BY doesn't seem to help. Instead of 10, it should show these 6. product_code date_signed description category 1 February, 01 2017 00:00:00 i have a green truck vehicle 1 February, 01 2017 00:00:00 i have a RED car color 2 February, 01 2017 00:00:00 i have a blue boat vehicle 2 February, 01 2017 00:00:00 i have a blue rug vehicle 3 February, 01 2017 00:00:00 i have a dark cat (null) 3 February, 01 2017 00:00:00 i have a dark dog (null) -- View this message in context: http://postgresql.nabble.com/Conditional-Lookup-Table-with-Like-tp5944796p5944807.html Sent from the PostgreSQL - sql mailing list archive at Nabble.com. -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql