Archives of the TeradataForum
Message Posted: Wed, 09 Jan 2008 @ 15:26:51 GMT
Subj: | | Most efficient way to make Date field into char(4) YYMM |
|
From: | | Anomy Anom |
<-- Anonymously Posted: Wed, 9 Jan 2008 09:17 -->
We have a table that has this as a lookup, so if I use that, I have code like:
sel tbl1.col1, tbl1.col2
from tbl1 inner join dateLkup
on dateLkup.date_YYMM = tbl1.date_YYMM
and dateLkup.real_date = current_date
I wondered if it might not be simpler (or more efficient) to do something like
sel tbl1.col1, tbl1.col2
from tbl1
where tbl1.date_YYMM = cast(current_date as char(4)) (format'YYMM')
I'm having trouble finding the exact syntax for something like option 2 also.
Thanks in advance!
|