• 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

Help with select statements

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need a select st that retrieves the current qtr date of employment using db2 date functions. result must be

7/7/2004
8/8/2004
9/9/2004
9/23/2004


Date of employment
1/1/2004
1/18/2004
3/5/2004
4/6/2004
6/2/2004
7/7/2004
8/8/2004
9/9/2004
9/23/2004
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Shan,
I think this would be easier to do without using any special date functions in db2.

Your query could be something like:
select employment_date from table where employment_date > ? and employment_date < ?

You can easily figure out the start and end dates in java (Calendar class.) It's platform independent and might also perform faster (being a simpler query.)
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
how do I find out given today's date which quarter it belongs to?

Like 9/24/04 belongs to qtr july-aug-sep)
 
Ranch Hand
Posts: 724
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
use QUARTER function, it returns the quarter which the date belongs to.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
example please? Is this a java function?
[ September 24, 2004: Message edited by: shan javan ]
 
David Ulicny
Ranch Hand
Posts: 724
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
it is SQL function
1. select quarter(your_date_column) from your_table
2. select * from your_table where quarter(your_date_column) = 1

it returns 1-4
[ September 24, 2004: Message edited by: David Ulicny ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic