Re: [SQL] Conditional Lookup Table with Like - Mailing list pgsql-sql

From sqlQuestions
Subject Re: [SQL] Conditional Lookup Table with Like
Date
Msg-id 1487354337689-5944937.post@n3.nabble.com
Whole thread Raw
In response to Re: [SQL] Conditional Lookup Table with Like  (sqlQuestions <ryanpgodfrey@gmail.com>)
List pgsql-sql
Ahh missing the LEFT JOIN. That's it! Thanks very much for your help David!


SELECT table1.product_code, table1.date_signed, table1.description, 
COALESCE ((    SELECT table3.category    FROM table3    WHERE table3.psc_code = table1.product_code    AND
lower(table1.description)LIKE ('%' || lower(table3.lookup_value) ||
 
'%')  ), table2.category) 
FROM table1 LEFT JOIN table2 ON table2.psc_code = table1.product_code 
WHERE date_signed = '2017-02-01';



--
View this message in context: http://postgresql.nabble.com/Conditional-Lookup-Table-with-Like-tp5944796p5944937.html
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.



pgsql-sql by date:

Previous
From: sqlQuestions
Date:
Subject: Re: [SQL] Conditional Lookup Table with Like
Next
From: Kaleeswaran Velu
Date:
Subject: [SQL] Question on MERGE in postgresql