The number of copies in table 1 and a link to table 2

Refer to this background question.

After creating this COUNT, how would I associate each of these “Prices”, for example, with the “Genre” column in TableTwo?

eg.

Table1: Prices, ID

Table2: Genre, ID

Output Example:

PRICES, COUNT, Genre
--------------------
13.99,   2,   Horror
52.00,   3,   Comedy
1.99,    1,   Romance

I should hope that this question will be easy to follow, but I will try to work out more on request! Hurrah!

EDIT:

Yes, this is a much simpler version of what I'm trying to do. As stated in the previous question, I have this field name that I want to count instances of. Now that I have this answer (from the previous question), now I want to link this to another table that I have (to improve some data a bit).

, , Blockbuster, 2 . TableOne "". Title ( "Dead Man Shoes" 10 . "Touch Of Evil" , 100 . , (From TableTwo).

:

Title,            Count,   Supplier
------------------------------------
Dead Man Shoes,  10,     Supplier1
Touch Of Evil,     100,    Supplier2

?

0
2
 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
+2

JOIN . :

SELECT * FROM prices JOIN genres ON ( prices.id = genres.id )

, .:)

.

0

Source: https://habr.com/ru/post/1720760/


All Articles