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…