Lead time & product group

Hey guys, we have two different locations. I want to find if there’s any item in our P21 for which lead time & product group is not the same in those two locations. I tried SQL to find out any such items where product group is different but it’s not returning correct result. Here is the query…

SELECT inv_mast_uid, product_group_id
FROM inv_loc
GROUP BY inv_mast_uid, product_group_id
HAVING COUNT(DISTINCT product_group_id) > 1;

I know this is not working because I changed product group of a item manually before executing the query but it din’t find that item.