Resolve field name to db field name when using distinct(#260, #264, #269)