title: How to copy data from one table to another via preparedStatement using MySQL?
body: <p>I am having the following code:</p>
  
  <pre><code>String sql ="INSERT INTO table_a (some_num, text, popularity) "
               + "SELECT numero, text, count(text) FROM table_b GROUP BY numero, text";          
              PreparedStatement pstm = conn.prepareStatement(sql);
              pstm.executeUpdate();
  </code></pre>
  
  <p>table_a is a table in my MySQL server with the following construction: some_num INT(11) NOT NULL, text VARCHAR(255), popularity INT(11);</p>
  
  <p>table_b is a TEMPORARY table in my code, with numero INT NOT NULL, text VARCHAR(255)</p>
  
  <p>I would like to INSERT all the rows from table_b into table_a, but end up having the following error trace:</p>
  
  <pre><code>SEVERE: null
  java.sql.SQLException: invalid new some_num data
  at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:964)
  at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3973)
  at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3909)
  at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2527)
  at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2680)
  at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2501)
  at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1858)
  at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2079)
  at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2013)
  at com.mysql.jdbc.PreparedStatement.executeLargeUpdate(PreparedStatement.java:5104)
  at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1998)
  at Tester.main(Tester.java:67)
  </code></pre>