I have a table A which looks like this:
|name|ID|
---------
|cow | 1|
|dog | 1|
|cat | 2|
|bird| 2|
|pig | 2|
And I have a table B:
|action|ID|
-----------
|eat | 1|
|drink | 2|
|go | 3|
And I want my result-table to look like this:
|name|ID|action|
----------------
|cow | 1|eat |
|dog | 1|eat |
|cat | 2|drink |
|bird| 2|drink |
|pig | 2|drink |
I tried something like:
SELECT * FROM A
LEFT JOIN B ON A.ID=B.ID
But that resulted in many more lines than table A had. Every other join seems to be wrong too.
What is the way to do it?