× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



"Best" is up for question. Let's say there's an index on the year, then
month, then day field. Then, for performance reasons, you might want to
convert the select date (for example, current date) into something that
will work with those fields. However, if performance isn't that big of a
concern (small file) or if you just have to do date calculations on that
field then I'd suggest this
select date(year concat '-' concat month concat '-' concat day) as
duhDate...
providing they are character or
select date(digits(year) concat '-' concat digits(month) concat '-' concat
digits(day)) as duhDate...
if they are numeric.
Then, you have to determine you are going to handle invalid dates, etc.
So, you might wrap that up into a user defined function to do it
select MakeADate(year, month, day) as duhDate...
And WHENEVER in the UDF can determine what to return on an invalid date. A
default date or null.
Now, if you're going to be banging out queries right and left against this
file you could try creating a view.
Create view MakesSense as
(select MakeADate(year, month, day) as duhDate, ...)
And that would work fine in Query/400 even.

You might find the idate function from Alan Campin that people have been
talking about a lot lately helpful.
http://www.think400.dk/downloads.htm

Rob Berendt

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 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.