title: selecting fields from multiple MySQL tables and what does (1=2) mean?
body: <p>I'm trying to understand what is happening in the following Coldfusion/MySQL query I'm having to update (and I'm in my first month of CF/MySQL).</p>
  
  <p>I have a query running before a search, which sets the variable <strong>pl</strong> (pricelists) like so:</p>
  
  <pre><code>&lt;cfif variables.module IS "yes"&gt; 
    &lt;cfquery datasource="ds" name="qp"&gt;
        &lt;!--- selects pricelist and seller ---&gt;
    &lt;/cfquery&gt;
    &lt;cfset variables.pl = "LEFT JOIN pricelist p ON "&gt;
    &lt;cfoutput query="qp" &gt;
      &lt;cfif qp.preislist IS ''&gt;
          &lt;cfset variables.pl= variables.pl &amp; '(p.iln = a.iln AND p.preislist = "AAA" AND p.ean = a.ean AND p.iln = "#qp.seller#") OR '&gt;
      &lt;cfelse&gt;
          &lt;cfset variables.pl= variables.pl &amp; '(p.iln = a.iln AND p.preisliste = "#qp.preislist#" AND p.ean = a.ean AND p.iln = "#qp.seller#") OR '&gt;
      &lt;/cfif&gt;
    &lt;/cfoutput&gt;
    &lt;cfset variables.pl = variables.preislisten &amp; "(1=0)"&gt;
  &lt;/cfif&gt;
  </code></pre>
  
  <p>This then is "ported" to the search query adding to my confusion like so:</p>
  
  <pre><code>&lt;cfquery datasource="ds" name="getArt"&gt;
      SELECT a.* &lt;cfif variables.module IS "yes"&gt;, p.ek, p.vk, p.waehrung, p.onlinepreis&lt;/cfif&gt;
      FROM artdata a
      &lt;cfif variables.module IS "yes"&gt;
          &lt;cfqueryparam cfsqltype="cfsql_varchar" value="#variables.pl#"&gt; 
      &lt;/cfif&gt;
      ....
  </code></pre>
  
  <p><strong>Plenty of questions:</strong><br>
   - there is no need to cfparam query fields such as <em>qp.seller</em>, or is there?<br>
   - shouldn't I always use ALIAS as in <em>artdata AS a</em> vs only using <em>artdata a</em>?<br>
   - Can I select <em>p.ek, p.vk, ...</em> like this although the pricelist table will only be declared later on through the variable <em>variables.pl</em> (being <em>LEFT JOIN pricelist p ON</em>...)<br>
   - What's up with the (1=0)? What is the purpose of it is? Dito for (3=2), (1=2).</p>
  
  <p>Thanks for some enlightenment! </p>