• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC Question

 
kesava chaitanya
Ranch Hand
Posts: 140
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
My Requisition_details table data is like this;i will do sending email and all those things;What i want is lets take user "vijay" has rejected 4 requisitions.how to group him ;i cannot hard code it like if rs.getString("userid") .equals("vijay") then call sendemail method;i dont know which user come will come from table.how to accomplish this.

requistionidstatususerId
1 Rejectedvijay
2 Newshekar
3Rejectedvijay
4InvalidDatashekar
5Rejectedjayavalli
6Rejectedvijay
7Rejectedjayavalli
8Rejectedshekar
9Rejectedvijay
10Rejectedshekar
11Rejectedjayavalli
12New vijay

in java class i have written like this;
Hashtable ht = new Hashtable();

try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc dbc:chaitu");
Statement stmt = con.createStatement();
ResultSet rs=stmt.executeQuery("select requistionid,status,userId from Requisition_Details");
while(rs.next()){
if(rs.getString("status").equals("Rejected")){
ht.put(rs.getString("requistionid"),rs.getString("userId"));
}
[ March 02, 2004: Message edited by: Bear Bibeault ]
 
Nicholas Cheung
Ranch Hand
Posts: 4982
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kesava,
I think this may not be a JSP problem, it should be a JDBC problem.
You can simply rewrite your query:
SELECT id, user FROM TABLE WHERE status = 'Rejected' GROUP BY user;
Does this help?
Nick.
[ March 02, 2004: Message edited by: Nicholas Cheung ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64205
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to the JDBC forum.
 
kesava chaitanya
Ranch Hand
Posts: 140
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Nicholas Cheung:
Hi Kesava,
I think this may not be a JSP problem, it should be a JDBC problem.
You can simply rewrite your query:
SELECT id, user FROM TABLE WHERE status = 'Rejected' GROUP BY user;
Does this help?
Nick.
noooooooooooooo;i cant change the query
[ March 02, 2004: Message edited by: Nicholas Cheung ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic