我想加入两个共享ID列的表
table one
id | name | age | class | contact |
+--+------+-----+-------+---------+
2 john 7 3 0245
4 mary 9 4 0356
and table two
id | name | money_spent |
+--+------+-------------+
2 john 6
2 john 5
4 mary 7
4 mary 4
2 john 3
我如何编写联接语句,以便从表2中看到一个孩子的记录以及他/她的所有花销 结果看起来像这样:
id | name | age | class | contact | money_spent |
+--+------+-----+-------+---------+-------------+
2 john 7 3 0245 6
2 john 7 3 0245 5
2 john 7 3 0245 3
4 mary 9 4 0356 7
4 mary 9 4 0356 4