title: ORDER BY with columns that are sometimes empty
body: <p>My SQL looks something like this:</p>
  
  <pre><code>SELECT CompanyName , LastName , FirstName FROM ... JOIN ...
  ORDER BY CompanyName , LastName , FirstName
  </code></pre>
  
  <p>Now the problem is that column A is sometimes empty (either as <code>NULL</code> or <code>""</code>), and I don't want all those results to turn up in the end.</p>
  
  <p>In the example, I'd like to have the fourth entry (which starts with a C) to be the third. But if I just ORDER BY, this happens:</p>
  
  <pre><code>Avagax Bauer Frank
  Bele AG Smith John
  Mork AG Baggins Frodo
  Chen Jun
  </code></pre>
  
  <p>In addition, I sometimes have more order-by columns in a few cases, either more or less important. This <em>might</em> be relevant.</p>
  
  <p>Addendums: Either last name or company must have a useful string. First name is completely optional. The system is PostgreSQL (8.4, might migrate to 9), and also SQLite. Vendor-independence would be a plus, because there are potential customers already running Oracle and SQLServer.</p>