View previous topic :: View next topic
|
Author |
Message |
rupesh gullu
New User
Joined: 12 Dec 2008 Posts: 96 Location: Gurgaon
|
|
|
|
Hi,
I have one date in AACCUM_PRD_STRT_DT in format 2007-06-01
and OTHER one IS TRM_DT in format 20081001
This has to be given in this way
Code: |
GIVEN A.ACCUM_PRD_STRT_DT <= B.TRM_DT AND
|
As the formats are different how can i achive this result. I need to use this Query in QMF
Regards,
Rupesh |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Hello Rupesh,
Could you please provide table defination of these two fields? |
|
Back to top |
|
|
rupesh gullu
New User
Joined: 12 Dec 2008 Posts: 96 Location: Gurgaon
|
|
|
|
Guptae,
Both are char field AACCUM_PRD_STRT_DT is CCYY-MM-DD of 10 bytes each and other TRM_DT is Char 8 bytes. Also
Regards,
Rupesh |
|
Back to top |
|
|
ashimer
Active Member
Joined: 13 Feb 2004 Posts: 551 Location: Bangalore
|
|
|
|
You might have to change the format of one date
Code: |
REPLACE(CHAR(DATE(A.ACCUM_PRD_STRT_DT),ISO),'-','') <= B.TRM_DT
|
|
|
Back to top |
|
|
rupesh gullu
New User
Joined: 12 Dec 2008 Posts: 96 Location: Gurgaon
|
|
|
|
Ashimer,
So this Query will change '-' to spaces and will give result as 20090601?? .. One more thing my B.TRM_DT is not char its declaration is DEC(8,0).
Now how i will compare in a Query in which one is Char and other is Decimal
Regards,
Rupesh |
|
Back to top |
|
|
ashimer
Active Member
Joined: 13 Feb 2004 Posts: 551 Location: Bangalore
|
|
|
|
It wont replace it by spaces.it will remove the '-' character.
note : do not put spaces between the quotes.
Now DEC(8,0) is not a date field .. Use CHAR(col) to convert this to character . |
|
Back to top |
|
|
rupesh gullu
New User
Joined: 12 Dec 2008 Posts: 96 Location: Gurgaon
|
|
|
|
Ashimr,
thanks for help but one problem i am facing. When i am changing DEC to Char it is giving me one period at end and due to that it is not comparing with char value.
e.g CHAR(TRM_DT) it is giving one period at end
20090809. This period at end is giving problem Is there any way to solve it
Regards,
rupesh |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
SUBSTR(CHAR(TRM_DT),1,8) ?? |
|
Back to top |
|
|
ashimer
Active Member
Joined: 13 Feb 2004 Posts: 551 Location: Bangalore
|
|
|
|
Code: |
DECIMAL(REPLACE(CHAR(DATE(A.ACCUM_PRD_STRT_DT),ISO),'-',''),10,0)
|
|
|
Back to top |
|
|
|