• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what will be return type

 
Arunkumar Chinnadurai
Ranch Hand
Posts: 56
Android MyEclipse IDE Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator




IF i execute this query "select sum(workinghours) from signin_signout where empid='tek001' and signindate='2012-04-20' group by empid,signindate" from db
it will return 8 (as sum value)

IF i execute from java rs.getInt("totalworkinghours") returns 0.. Please help what i have done as mistake.

 
Wendy Gibbons
Bartender
Posts: 1110
Eclipse IDE Oracle VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know how to fix your problem, and I think i know why

so first the why
in your select you are selecting "sum(workinghours)"

then trying to use the column name "totalworkinghours", well there isn't a column called that in your select. i would expect an exception but it is being nice and returning 0.

the solution: you have 2 options


or
 
Arunkumar Chinnadurai
Ranch Hand
Posts: 56
Android MyEclipse IDE Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry guys, i did a small mistake ....now i got clear.

"Without updating working hours values i cannot store working status"

Thanks Friends


 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic