wood burning stoves 2.0*
The moose likes JDBC and the fly likes Counting number of rows returned by select Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Counting number of rows returned by select " Watch "Counting number of rows returned by select " New topic
Author

Counting number of rows returned by select

Kim Kantola
Ranch Hand

Joined: May 17, 2001
Posts: 274
Hi Yall,
I am performing a select distinct sql statement in order to get a number of products from a table, I am not really interested in the product names themselves though, but am interested in how many of them there are, for example, if I have a table with rows like this:


And my sql is this:


I get returned the rows:
[B]Apple
Orange
Bannana[B]

But what I am interested in is the fact that there are three of them. Can I add something to the sql to have it return the number of rows returned (3) or do I have to iterate over the result set to find the number?
Thanks a bunch for any info,
Kim
nilesh Katakkar
Ranch Hand

Joined: Oct 27, 2004
Posts: 35
Select count(distinct FruitName) from PRODUCE


nilesh<br />neilindallas@hotmail.com
Kim Kantola
Ranch Hand

Joined: May 17, 2001
Posts: 274
thanks !
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Counting number of rows returned by select
 
Similar Threads
mySQL Inner join
SQL question
distinct in qbc
Diplaying top five employee names taking highest salary
Complicated SQL query help