title: Get all rows from group by query
body: <p>I have database sqlite contain 2 tables: </p>
  
  <p><strong>names</strong></p>
  
  <p><a href="https://i.stack.imgur.com/KpRZT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KpRZT.png" alt="Table with two columns. The column id contains numbers and the column name contains strings."></a></p>
  
  <p><strong>n_data</strong></p>
  
  <p><a href="https://i.stack.imgur.com/8kJ2D.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8kJ2D.png" alt="Table with three columns. The column id contains numbers, the column name_id contains numbers, and the column value contains strings."></a></p>
  
  <p>and query: </p>
  
  <pre><code>select 
      n_data.id,n_data.value, count( n_data.id) as count 
  from 
      n_data 
  INNER JOIN names on names.id = n_data.name_id 
  group by 
      n_data.name_id 
  order by 
      n_data.id asc
  </code></pre>
  
  <p>In activity I have used 
  Cursor and while </p>
  
  <pre><code> while (res.moveToNext()) {
        System.out.println("id=&gt;"+res.getString(0)+" count=&gt;"+res.getString(2)+" =value=&gt;"+res.getString(1));
   }
  </code></pre>
  
  <p>but result just show last row in group. How can I get all rows for every group?</p>
  
  <pre><code>CREATE TABLE "names" (
      id  INTEGER PRIMARY KEY AUTOINCREMENT,  
      name    TEXT );
  INSERT INTO names (id,name) VALUES  
  (1,'name_1'),  
  (2,'name_2'),  
  (3,'name_3'),  
  (4,'name_4');  
  CREATE TABLE "n_data" (
      id  INTEGER PRIMARY KEY AUTOINCREMENT,  
      name_id TEXT,  
      value   TEXT );  
  INSERT INTO n_data (id,name_id,value) VALUES  
  (1,'3','value_8'),  
  (2,'2','value_7'),  
  (3,'2','value_6'),  
  (4,'2','value_5'),  
  (5,'1','value_4'),  
  (6,'1','value_3'),  
  (7,'1','value_2'),  
  (8,'1','value_1'),  
  (9,'3','value_9');
  </code></pre>