• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JDBC Question

 
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to the JDBC forum.
 
kesava chaitanya
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]

 
You have to be odd to be #1 - Seuss. An odd little ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic