title: How can an get count of the unique lengths of a string in database rows?
body: <p>I am using Oracle and I have a table with 1000 rows.  There is a last name field and </p>
  
  <p>I want to know the lengths of the name field but I don't want it for every row.  I want a count of the various lengths.</p>
  
  <p>Example:</p>
  
  <p>lastname:</p>
  
  <pre><code>smith
  smith
  Johnson
  Johnson
  Jackson
  Baggins
  </code></pre>
  
  <p>There are two smiths length of five.  Four others, length of seven.  I want my query to return</p>
  
  <pre><code>7
  5
  </code></pre>
  
  <p>If there were 1,000 names I expect to get all kinds of lengths.</p>
  
  <p>I tried,</p>
  
  <pre><code>Select count(*) as total, lastname from myNames group by total
  </code></pre>
  
  <p>It didn't know what total was.  Grouping by lastname just groups on each individual name unless it's a different last name, which is as expected but not what I need.</p>
  
  <p>Can this be done in one SQL query?</p>