Are they numeric or character types? I usually create a string like
"where date(myyear concat '-' concat mymonth concat '-' concat myday) =
...". I like ISO formatted dates (yyyy-mm-dd) due to their explicit
nature.
The SQL date built-in function likes string representation of dates (my
example above), string of len 7 representing yyyyddd, or a positive
number <= 3652059.
If you're going to do this a lot, consider developing your own UDF that
can take advantage of caching (deterministic = true). There's an iDate
function set for i5/OS (freeware IIRC) which does many useful things.
Loyd Goodbar
Business Systems
BorgWarner Shared Services
662-473-5713
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Bradley V. Stone
Sent: Monday, October 20, 2008 11:18 AM
To: MIDRANGE-L@xxxxxxxxxxxx
Subject: Best method using SQL to combine date fields (day, month, year)
Ok, building some dynamic SQL statements.
Got to a file that has date separated into year, month and day fields.
Ugh.
So, wondering the best/easiest way to combine these so I can use them in
an
SQL statement? Hopefully some magical SQL command that I can use
inline?
Thanks!
Bradley V. Stone
BVSTools - www.bvstools.com
eRPG SDK - www.erpgsdk.com
As an Amazon Associate we earn from qualifying purchases.
This thread ...
RE: Best method using SQL to combine date fields (day, month, year), (continued)
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.