|
Well, I don't know if we answered Joel's question satisfactorily but I got two for the price of one! In fact I have had occasion lately trying to remember one or the other of both of these, (COALESCE and CASE), though the former was a more direct hit on the specific question. So thanks! I've wracked my brain on how to get around your problem, Joel, and can't think of anything. Thought if you had a way to replace the system default date value with a null, you could use that, but of course you couldn't use SQL. - Alan ----- Original Message ----- From: "Anton Gombkötö" <gombkoetoe@xxxxxxxxxx> To: "RPG programming on the AS400 / iSeries" <rpg400-l@xxxxxxxxxxxx> Sent: Sunday, October 12, 2003 3:48 AM Subject: Re: SQL loval date/timestamp--(function in SQL to select avaluefrom a list) | Hi, | | >> This reminds me of a pending question I've had that might | >> help. I've checked the manual, but can someone refresh my | >> mind on the SQL function that takes one value from a list of | >> two, where one is a database value, and the other is a value | >> to select in case the database value is null? (Or something | >> like that?) | | > I believe you're thinking of COALESCE: | | > select lastname, firstname, coalesce(char(termination_date), 'ACTIVE') from | > employees | | Sounds more like "CASE" for me; in this sample i'm setting a field to | be used in a HTML class="xxx" later on: | | SELECT ..., | CASE | WHEN COENDT > COENDP THEN 'OVERDUE' | ELSE '' | END AS CLASSCOENDT, | CASE | WHEN SUM(CODBWR) >= SUM(CODBWP) THEN 'OK' | WHEN SUM(CODBWR) > 0 AND SUM(CODBWR) < SUM(CODBWP) THEN 'ATTN' | WHEN SUM(CODBWR) < 0 THEN 'ALERT' | ELSE '' | END AS CLASSCODB, | ... | | 0.02 Euro | | best regards, | | Anton Gombkötö | | | | _______________________________________________ | This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list | To post a message email: RPG400-L@xxxxxxxxxxxx | To subscribe, unsubscribe, or change list options, | visit: http://lists.midrange.com/mailman/listinfo/rpg400-l | or email: RPG400-L-request@xxxxxxxxxxxx | Before posting, please take a moment to review the archives | at http://archive.midrange.com/rpg400-l. |
As an Amazon Associate we earn from qualifying purchases.
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.