How do you access the value of an SQL count () query in a Java program

前端 未结 7 1138
梦毁少年i
梦毁少年i 2021-02-01 00:54

I want to get to the value I am finding using the COUNT command of SQL. Normally I enter the column name I want to access into the getInt() getString() method, what do I do in t

7条回答
  •  生来不讨喜
    2021-02-01 00:56

    Statement stmt3 = con.createStatement();
    
    ResultSet rs3 = stmt3.executeQuery("SELECT COUNT(*) AS count FROM "+lastTempTable+" ;");
    
    count = rs3.getInt("count");
    

提交回复
热议问题