Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
The moose likes JDBC and Relational Databases 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 Badass: Making Users Awesome this week in the Game Development forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
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: 275
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: 275
thanks !
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Counting number of rows returned by select