View previous topic :: View next topic
|
Author |
Message |
itmanand
New User
Joined: 18 Dec 2008 Posts: 24 Location: Newyork
|
|
|
|
I have field in my table that is defined as SMALLINT. Below is the field, the format and the values.
AB_YEAR SMALLINT
The values 2001, 2002, 2003,2004, 2005, 2006, 2007 and 2008.
I want to run two unload queries.
1. To fetch the data prior to 2007 in file-1.
2. To fetch the data from 2007 into file-2.
I can do this by giving AB_YEAR < 2007 and AB_YEAR >= 2007. However I want this to be dynamic and do not want to change ti next year to AB_YEAR < 2008 and AB_YEAR >= 2008.
Can someone help me on this? |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
itmanand,
This might be of some help.
YOUR_TABLE
Code: |
AB_YEAR
SMALLINT
--------
********
2001
2002
2003
2004
2005
2006
2007
2008 |
SQL
Code: |
SELECT AB_YEAR
FROM YOUR_TABLE
WHERE AB_YEAR < YEAR(CURRENT TIMESTAMP) - 1
WITH UR; |
RESULT
Code: |
AB_YEAR
SMALLINT
--------
********
2001
2002
2003
2004
2005
2006 |
|
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
itmanand,
Just curious, does this have anything to do with an almost similar requirement in SyncSort posted by you HERE. |
|
Back to top |
|
|
|