title: SQL querying multiple tables in one query
body: <p>I'm currently trying to create a query so that I can output the full details of a band stored within my database. There are currently 5 tables in my database, they are, <code>bands</code>, <code>gigs</code>, <code>members</code>, <code>comments</code> and <code>tracks</code>. What I want to do is link all the data from each of the tables to the corresponding band provided in the URL variable. For example:</p>
  
  <pre><code>&lt;cfquery datasource="#application.datasource#" name="get-details"&gt;
      Select *
      From bands, gigs, members, comments, tracks
      Where gig_bandid = URL.id and member_bandid = URL.id and comments_bandid = URL.id and track_bandid = URL.id
  &lt;/cfquery&gt;
  </code></pre>
  
  <p>I wanted to do this because currently, I have 4 separate queries checking each of the four tables to see if they have any data contained matching the band id of the one provided in the URL. The issue I have is I want to output it all in one query, using terms such as <code>member_name</code>, rather than having to use <code>get-members.member_name</code>. I've tried using <code>JOIN</code> but to no avail. I assume that only works using two tables. Can provide extra details if needed.</p>