${if(pklb="1", "select * from xxx ", " select * from xxx where ${if(count(split(period,","))=1,"quarter_id='"+CONCATENATE(INDEXOFARRAY(REVERSEARRAY(split(period,",")),1))+"'","month_id='"+REPLACE(INDEXOFARRAY(REVERSEARRAY(split(period,",")),1),'-','')+"'")} " )} |