问题描述
请参阅背景问题。
在构建此COUNT之后,我如何将每个价格链接到TableTwo中的Genre列?
例如
表1:价格,ID
表2 :Genre,ID
输出示例:
PRICES,COUNT,类型
--------------------
13.99,2,恐怖
52.00,3,喜剧
1.99,1,浪漫
很容易遵循,但我会 进一步要求进一步阐述!干杯!
编辑:
是的,这是我想要做的更简单的版本。正如在上一个问题中所说,我有这个字段名称,我想计算的实例。现在我有这个答案(从上一个问题),我现在想链接到另一个表,我有(帮助我分析一些数据更好一点)。
为了举例,假设我们有一个Blockbuster分支,有两个供应商。在TableOne我有'标题'。我现在已经从Title中列出了每一个唯一的值,并计算每一个(所以在商店我有一个独特的标题叫死人的鞋子,有10份,但是,我也有一个独特的标题叫做因为
示例输出:
标题,计数,供应商
--------------------- ---------------
Dead Man's Shoes,10,Supplier1
Touch Of Evil,100,Supplier2
解决方案SELECT t1.Prices,COUNT(t1.ID)AS TheCount,t2.Genre
FROM Table1 AS t1
INNER JOIN Table2 AS t2
ON t1.ID = t2 .ID
GROUP BY t1.Prices,t2.Genre
Please refer to this background question.
After constructing this COUNT, how would I then link each of these 'Prices' to, for instance, a column called 'Genre' in TableTwo?
e.g.
Table1: Prices, ID Table2: Genre, ID
Example output:
PRICES, COUNT, Genre -------------------- 13.99, 2, Horror 52.00, 3, Comedy 1.99, 1, Romance
I should hope this question is easy to follow however I will try to elaborate further on request! Cheers!
EDIT:
Yes, this is a much simpler version of what I'm trying to do. As said in the previous question, I have this field name that I want to count the instances of. Now that I have this answer(from the previous question), I now want to link this to another table that I have(to help me analyse some data a little better).
For sake of example, let's say we have a Blockbuster branch that has 2 suppliers. In TableOne I have 'Title'. I have now listed each unique value from Title and counted each one (So in the store I have a unique title called 'Dead Man's Shoes' and there is 10 copies. However, I also have a unique title called 'Touch Of Evil' and because this is more popular, there is 100 copies. I now want to see which supplier these two come from (From TableTwo). Therefore
Example output:
Title, Count, Supplier ------------------------------------ Dead Man's Shoes, 10, Supplier1 Touch Of Evil, 100, Supplier2
Does that help any better?
解决方案SELECT t1.Prices, COUNT(t1.ID) AS TheCount, t2.Genre FROM Table1 AS t1 INNER JOIN Table2 AS t2 ON t1.ID = t2.ID GROUP BY t1.Prices, t2.Genre
这篇关于在Table1中计数实例,并链接到Table2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!