title: MySQL selecting a column from another table
body: <p>I'm trying to pull information from a second table (particularly, the <code>class</code> column). I have two tables:</p>
  
  <pre><code>CREATE TABLE `tags` (
    `Tag` varchar(255) NOT NULL,
    `class` tinytext NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  --
  -- Dumping data for table `tags`
  --
  
  INSERT INTO `tags` (`Tag`, `class`) VALUES
  ('Arya', 'label-default'),
  ('bull', 'label-info'),
  ('Cats', 'label-default'),
  ('Floki', 'label-default'),
  ('Overwatch', 'label-info'),
  ('Ragnar', 'label-default');
  
  --
  -- Indexes for dumped tables
  --
  
  --
  -- Indexes for table `tags`
  --
  ALTER TABLE `tags`
    ADD PRIMARY KEY (`Tag`);
  
  
  CREATE TABLE `post_tags` (
    `ID` int(11) NOT NULL,
    `PostID` int(11) NOT NULL,
    `tagID` tinytext NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  
  --
  -- Dumping data for table `post_tags`
  --
  
  INSERT INTO `post_tags` (`ID`, `PostID`, `tagID`) VALUES
  (1, 27, 'Cats'),
  (2, 27, ' Ragnar'),
  (3, 27, ' Floki'),
  (4, 27, ' Arya');
  
  --
  -- Indexes for dumped tables
  --
  
  --
  -- Indexes for table `post_tags`
  --
  ALTER TABLE `post_tags`
    ADD PRIMARY KEY (`ID`);
  </code></pre>
  
  <h2>Goal:</h2>
  
  <pre><code>| Tag    | class
  |--------|--------------
  | Cats   | label-info
  | Ragnar | label-default
  | Arya   | label-danger
  | Floki  | label-info
  </code></pre>
  
  <p>I've tried using this Query, but only one row is being returned:</p>
  
  <pre><code>SELECT * FROM `tags` WHERE `Tag` IN 
  (SELECT `tagID` FROM `post_tags` WHERE `post_tags`.`PostID` = 27)
  </code></pre>