I'm using PostgreSQL 9.0.4 and was wondering if someone could help me with a query.
I have a table of graduates from a university that lists a graduate's names and degrees. The problem is, if a person has multiple degrees, multiple records are created. For example, if John Smith has three degrees, there would be three records such as:
Smith | John | B.S Mathematics
Smith | John | B.S Physics
Smith | John | M.S Physics
I want to combine these three records of the same person into one record, comma-separating their degrees. For example, the above three records should become one like this:
Smith | John | B.S Mathematics, B.S Physics, M.S Physics
I've come across the CONCAT function but I don't know how to adapt it for my particular situation. Another alternative is to do it via a programming language interface (I use the C# Npgsql interface to PostgreSQL). But I would like to do know how to do this with command-line SQL.