%possibleSQLargs = { 1 => "and table.column = 'NEW'"; 4 => "and table.column = 'PND'"; 9 => "and table.column = 'CLS'"; 5 => "and (table.column = 'NEW' or table.column = 'PND')"; 10 => "and (table.column = 'NEW' or table.column = 'CLS')"; 13 => "and (table.column = 'PND' or table.column = 'CLS')"; 15 => "and (table.column = 'NEW' or table.column = 'PND' or table.column = 'CLS')"; }; $extraqueryarg = $possibleSQLargs{'$sum'};