sql - MySQL Select Youngest child of user -
i got following problem. i'd select youngest kid of each customer , show age of kid. so, output has this:
abc@example.com 12 cde@example.com 15 efg@example.com 8 if id has more 1 kid, youngest kid should shown.
table "customers" id email table "kids" id ageofkid any highly appreciated.
thanks
that's query looking for
select c.email,min(k.ageofkid) customers c inner join kids k on k.id=c.id group c.id
Comments
Post a Comment