aspose file tools*
The moose likes JDBC and the fly likes need to find category Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "need to find category" Watch "need to find category" New topic
Author

need to find category

pankaj semwal
Ranch Hand

Joined: Oct 07, 2008
Posts: 300

Hi ,

I am getting the category like .Sr Prgorammer,Ass.Programmer and Programmer like etc
But i am unable to find out how many times the Sr.Progrmmer ,Ass.Prormmer etc can
be count using java code
Please help me.
Thanks


Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

pankaj semwal wrote:

But i am unable to find out how many times the Sr.Progrmmer ,Ass.Prormmer etc can
be count using java code


I don't get your question, Do you want to count How many times "Sr.Progrmmer ,Ass.Prormmer", category occurred in a given result set, Then just get the counter for each of category and increment it when you found that category


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Muhammad Ijaz
Ranch Hand

Joined: Mar 03, 2009
Posts: 34
I think what Sagar Rohankar is saying is the right solution. But If your concern is to get a sql statement that will also count the categories, you will have to build your sql statement with group by clause counting the categories


IBM Certified WebSphere Commerce Application Developer

pankaj semwal
Ranch Hand

Joined: Oct 07, 2008
Posts: 300
yes.But using java code.

Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

pankaj semwal wrote:yes.But using java code.


Then whats the problem in adding counter and incrementing in the same code?, like

pankaj semwal
Ranch Hand

Joined: Oct 07, 2008
Posts: 300

after that i have to calculate the total salary of each category
i.e
srProgrammerCounter++; // counter
System.out.println("cat"+category);
System.out.println("jobSalary in Sr"+jobSalary)*srProgrammerCounter;
srProgrammerSal=jobSalary+jobSalary*unit/100;


will this return the exact answer.
Muhammad Ijaz
Ranch Hand

Joined: Mar 03, 2009
Posts: 34
You can calculate as follows:

srProgrammerCounter++; // counter
System.out.println("cat"+category);
System.out.println("jobSalary in Sr"+jobSalary*srProgrammerCounter);
srProgrammerSal=jobSalary+jobSalary*unit/100;
srProgrammerSal = srProgrammerSal*srProgrammerCounter;





Hope it will help

Pomy
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Muhammad Ijaz wrote:
srProgrammerSal = srProgrammerSal*srProgrammerCounter;

srProgrammerSal *= srProgrammerCounter;
 
 
subject: need to find category