title: In MySQL, how can I concatenate multiple rows and then search on that data?
body: <p>Struggling a bit with MySQL. I've found the <code>GROUP_CONCAT</code> function which looks right for my needs, but I can't work out how to use it. What I'd like to do is search in several columns as well as the concat column; so if any of the columns equal my search term (<code>%a%</code> in this example) it should be returned. I've worked out how to return the concatenated genre string but I can't work out how to search on it.</p>
  
  <pre><code>SELECT albumArtworkURL, albumName, albumID, 
    b.artistID AS ArtistID, b.artistName AS ArtistName,
    GROUP_CONCAT(DISTINCT c.songGenre separator ',') AS genres
  FROM album
  LEFT JOIN artist b ON album.albumArtist = b.artistID
  LEFT JOIN song c ON albumID = c.songOnAlbum
  WHERE albumName LIKE '%a%' OR albumYear LIKE '%a%'
  GROUP BY albumArtworkURL, albumName, albumID, ArtistID, ArtistName
  ORDER BY albumYear ASC, albumName ASC
  </code></pre>
  
  <p>Would really appreciate some help. Thanks :-)</p>