使用查询结果在SQLite中创建新表

时间:2016-11-12 17:24:46

标签: java database sqlite

我在Java中使用此代码,我需要将结果插入到新表中。只需编辑此查询就可以了吗?

  ResultSet result = stat.executeQuery("SELECT artist, COUNT(artist) AS countartist FROM table1 GROUP BY artist ORDER BY countartist DESC;");

1 个答案:

答案 0 :(得分:-1)

试试这个:

ResultSet result = stat.executeUpdate(" CREATE TABLE newtable AS SELECT artist,COUNT(artist)AS countartist FROM table1 GROUP BY artist ORDER BY countartist DESC");