File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes query database/output count and summation to servlet? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "query database/output count and summation to servlet?" Watch "query database/output count and summation to servlet?" New topic
Author

query database/output count and summation to servlet?

Nicole Jones
Greenhorn

Joined: Mar 18, 2011
Posts: 21
I have this database query that adds the total dollar amount by funder and counts the number of projects per funder. obviously, neither the total or the count is stored in my database....should it be? because how would i access the count and total from a servlet if neither are stored the database?

here is my query:

Any help will be greatly appreciated.
Nicole Jones
Greenhorn

Joined: Mar 18, 2011
Posts: 21
Nevermind, doh. I figured it out.

This is the desired query:



code to set the alias columns:

Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18669
    
    8

Yep, that should work fine. Here's another method which doesn't require aliases for the computed columns:

(The columns are numbered from left to right in the query, starting at 1.)
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: query database/output count and summation to servlet?