grouping drugs using id