one to many relationship sql query code example
Example 1: sql join one to many
SELECT *
FROM Parent P
INNER JOIN Child C
ON C.ParentId = P.ParentId
Example 2: 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