只有当它们存在于另一个表中时,我才能对一个表中的值求和。
例如 table1 - typeOfBiscuits
biscuits
jaffacakes
digestives
table2 - inventry
type number
digestives 2
digestives 3
jaffacakes 2
digestives 3
jaffacakes 4
cheesecake 1
期望的结果select Count(number) from Inventry where type = <not sure how to get type from typeOfBisuit table>
type count
digestives 8
jaffacakes 6
我的尝试如下,但我收到“对多部分字符串的引用”错误
select Count(number) from Inventry where type = typeOfBiscuits.type