for example I have two table like this :
Table Parent
+===========+==============+
| FirstName | (PK)LastName |
+===========+==============+
| Bob | Newbie |
| Bella | Goth |
+===========+==============+
Table Child
+===========+==============+
| FirstName | (FK)LastName |
+===========+==============+
| Cassandra | Goth |
| Cindy | Newbie |
| Mortimer | Goth |
+===========+==============+
what should I do to have a SELECT result like this :
+========+============+=====================+
| Family | ParentName | ChildName |
+========+============+=====================+
| Goth | Bella | Cassandra, Mortimer |
| Newbie | Bob | Cindy |
+========+============+=====================+
what I've tried so far
SELECT
A.LastName Family,
A.FirstName ParentName,
(
SELECT
COALESCE(B.FirstName + ',' , '') + B.FirstName
FROM
Child B
WHERE
B.LastName = A.LastName
) ChildName
FROM
Parent A
ORDER BY
Family ASC
but when I execute it shows
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
any idea?