Sql join one to many

This article is tagged with: Sql join one to many and mysql

sql join one to many

SELECT *
FROM Parent P
INNER JOIN Child C
ON C.ParentId = P.ParentId

sql join one to many

SELECT P.Name
, P.Address
, SUM(C.Amount)
FROM Parent P
INNER JOIN Child C
ON C.ParentId = P.ParentId
GROUP BY P.Name
, P.Address

This article is tagged with: Sql join one to many and mysql