def grouping2sql(column, recodedict):
    """
    Takes a dict and transforms it to a SQL statement for recoding levels
    """
    sql_when = ["case"]
    sql_when += [f"when {column} = '{index}' then '{level}'" for index,level in recodedict.items()]
    sql_when += ["else '-1' end"]
    sql_when = " ".join(sql_when)
    return sql_when