skip to Main Content

PostgreSQL JOIN a single, most recent row

We have this query that is running: SELECT concat_ws(' ', z.ticker, CASE WHEN a.date_approved IS NOT NULL THEN TO_CHAR(a.date_approved,'YYMMDD') WHEN z.date_recommended IS NULL THEN '000000' ELSE TO_CHAR(z.date_recommended,'YYMMDD') END, CASE WHEN s.ticker IS NOT NULL THEN 6 WHEN a.approved_recommendation IS NOT…

VIEW QUESTION

Postgresql – Split string using Regex in Postgres function

I need help splitting the string below using REGEXP_SPLIT_TO_ARRAY in a Postgres function: keyone="valone" key_two="val two" KEY_THREE=val three keyfour="http://sample.domain?par1=val1&par2=val2" keyFIVE=valfive and the resultant array should look like this: (keyone="valone",key_two="val two",KEY_THREE=val three,keyfour="http://sample.domain?par1=val1&par2=val2",keyFIVE=valfive) I ended up with this myarray := REGEXP_SPLIT_TO_ARRAY(mystring, E'\s(?=([^"]*"[^"]*")*[^"]*$)');…

VIEW QUESTION
Back To Top
Search