Q:

How to print together elements from two different MySQL tables

Okay, so I have these two tables in MySQL. One is called 'History' and one is called 'Annotated'. 
The 'History' table is full of random YouTube video id's that can be repeated. The 'Annotated' table contains a unique copy of each video id along with a description of that id. Looks something like this:
 History                            Annotated

 videoid                    videoid          description

 videoid_1                  videoid_1        descript_1
 videoid_1                  videoid_2        descript_2
 videoid_3                  videoid_3        descript_3
 videoid_2                  etc.             etc.
 videoid_3
 videoid_1
 etc.

I'm trying to print out a specific set of video id's from the History table, duplicates and all. That is quite simple. The problem is I need to print their description beside them.
So I have an array of the History video id's I want to print and I'm trying to write a MySQL command that will print the corresponding descriptions beside them but it's not working properly. Here's what I have so far:
$implodedIdVideo = the array of specific history video id's, imploded for MySQL

SELECT History.videoid, Annotated.description 
FROM History, Annotated 
WHERE History.videoid = Annotated.videoid 
AND History.videoid IN ($implodedIdVideo)
ORDER BY History.videoid DESC";

while($row = mysql_fetch_array($query)){
echo $row['videoid']. " : ". $row['description'];
echo "<br />";
}

This above MySQL command works but its supposed to give me like 10 results but I'm getting like 50 and I have no idea why. I'm hoping if someone understands what I'm trying to do, they'll be able to recognize what I'm doing wrong?

A:

That's because you have duplicates in your History table, so the server return a description for each one. Try adding GROUP BY History.videoid before the ORDER.
Complete query should look like this:
SELECT 
    History.videoid, Annotated.description 
FROM 
    History, Annotated 
WHERE 
    History.videoid = Annotated.videoid 
AND 
    History.videoid IN ($implodedIdVideo)
GROUP BY 
    History.videoid
ORDER BY 
    History.videoid DESC";

