我有两个表,规范化:
table1
id quality product_id
1 100 1
2 100 2
3 10 4
4 50 2
Run Code Online (Sandbox Code Playgroud)
和
table2
product_id product material
1 tinder metal
2 gold metal
3 timber wood
4 stone rock
Run Code Online (Sandbox Code Playgroud)
如何获得第一张桌子上的所有金属物品?我试过
select sum(quality) from table1 join table2 on table2.material = 'metal';
Run Code Online (Sandbox Code Playgroud)
但似乎不正确(720),应该是250。
join ×1