Possible Duplicate:
How do I get the row count in JDBC?
Hi,
How can I count a query in a row in MySQL
database using sql count statement with JAVA
?
tq
Possible Duplicate:
How do I get the row count in JDBC?
Hi,
How can I count a query in a row in MySQL
database using sql count statement with JAVA
?
tq
How about
select count(*) from
table_name
Usage would be something like:
int count;
String table = ...
Statement st = ...
ResultSet rs = st.executeQuery("select count(*) from " + table);
while (rs.next()){
count = rs.getInt(1);
}
If you are looking for a query to get the count :
SELECT COUNT(*) FROM MyTable