Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to calculate fine for library

 
sarathd kumar
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi All... i am working on library task i need someone delay to return book i want add fine for how many extra day he will take to return a book

this is i am working so far..

select
( cast(CURDATE() as date) - cast(rdate as date) ) * 3 as fine
from issues
where
rdate > CURDATE()

thanks for advance...
 
K. Tsang
Bartender
Posts: 3585
16
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems you have the "fine" calculated in the sql as (current date - date in DB) * 3. I presume the "3" in whatever currency is the late charge. So the date difference * 3 gives you the fine.
 
Junilu Lacar
Bartender
Pie
Posts: 8874
81
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[Edit: post has since been moved from JSP forum to JDBC forum] -- Also, how does this relate to JSPs? I hope you're not trying to run a SQL query in your JSP... that would be bad form. The only kind of logic that you should have in JSPs is logic that relates to displaying and formatting information that has already been processed elsewhere in your program.
 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assuming that rdate is the date the book was due, I'd say your approach is in the right direction. Which difficulties are you encountering?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic