RETURNS TABLE (agencycode INT, bureaucode INT, acctname VARCHAR, beacat VARCHAR, onoffbudget VARCHAR, val INT) AS $$ BEGIN RETURN QUERY SELECT t1.agencycode, t1.bureaucode, t1.acctcode, t2.beacat, t2.onoffbudget, t2.XXXXXX FROM allnames AS t1 JOIN total AS t2 on t1.agencycode = t2.agencycode and t1.bureaucode = t2.bureaucode and t1.acctcode = t2.acctcode WHERE t2.XXXXXXX != 0 ORDER BY t1.agencycode, t1.bureaucode, t1.acctcode; END; $$ LANGUAGE 'plpgsql'; I want to replace XXXXXXX with the argument year. I hard coded the XXXXXX with 'y2016' and I get back a table Would something like 't2.'||(year)|| work? On 08/28/2018 10:24 PM, Thomas
Boussekey wrote:
|