If you're trying to concantenate unique combinations of values for "A" and "B" in the SELECT statement, I don't think that's going to work.
Try SELECT unique A, B, count(*)
FROM some_table
GROUP by 1,2
HAVING count(*) > 1 <----- optional, depends on your needs
ORDER by 1,2