View previous topic :: View next topic
|
Author |
Message |
sm_2009
New User
Joined: 10 May 2009 Posts: 72 Location: bangalore
|
|
|
|
hi
i have a req as follows:
i use query for selecting date from table
but one of the filering criteria is year part of the date(from table) = input year
how can i write this is query..? i am using a cursor to fetch rows.
pls suggest |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Shouldn't this be in the DB2 forum because SQL queries can be written for several languages? |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
It should be easy:
Code: |
SELECT * FROM my.table WHERE YEAR(my_date_field) = YEAR(CURRENT DATE) |
|
|
Back to top |
|
|
sm_2009
New User
Joined: 10 May 2009 Posts: 72 Location: bangalore
|
|
|
|
will it work if Current date is a ws field
means YEAR(WS-INPUT-DATE)
ws-input-date is in db2 format |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
I hoped YOU would tell me.
So please try and tell me (and don't forget the":" thingy). |
|
Back to top |
|
|
sm_2009
New User
Joined: 10 May 2009 Posts: 72 Location: bangalore
|
|
|
|
hey yesss its working
thanks |
|
Back to top |
|
|
|