Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to find out number of years worked using sql

 
Pol Appan
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,


How to find from a table which has hiredate and should return number of years worked with range like 0-5, 5-10,10-15 etc.

Any help is highly appreciated.

Thanks
 
Joel McNary
Bartender
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What database are you using? Date functions are often db-specific, so we'd need to know that.
 
Scott Selikoff
author
Saloon Keeper
Posts: 4014
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you trying to do it in a single SQL statement or in PLSQL such as in a stored procedure? Also is the range part of the input parameters? Such as if I set 7 it should do 0-7, 7-14, etc instead of increments of 5?
 
Pol Appan
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using Oracle 9i and not using pl/sql, plain sql.

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic