SQL query IFNULL

Gregoire William wgregoire at paris.mediagerance.com
Thu Oct 7 12:33:17 CDT 2004


i bump this one year old message because i currently have the same prblem...

i'm trying to do a
SELECT IFNULL(name,'rien')
but i read on ValentinaList you need a BaseObject methods


I modified the "005 (Methods)" example :
I removed the data of "frank" and modified nameUpr to have
"jon    roberts    26/06/2001 16:41:12    JON    ROBERTS    2001    "
"    schima    27/06/1998 16:41:12    rien    SCHIMA    1998    "

1/
with set fldRef = addField(gDB, ArtistRef, "nameUpr", #kTypeString, 20, 0,
"IF(name is null, name,'rien')" ) , I have

"jon    roberts    26/06/2001 16:41:12    rien    ROBERTS    2001    "
"    schima    27/06/1998 16:41:12    rien    SCHIMA    1998    "


2/
with set fldRef = addField(gDB, ArtistRef, "nameUpr", #kTypeString, 20, 0,
"IFnull(name,'rien')" ) , i have

"jon    roberts    26/06/2001 16:41:12    jon    ROBERTS    2001    "
"    schima    27/06/1998 16:41:12        SCHIMA    1998    "




what's wrong ?!

thanks

WilG




-----Message d'origine-----
De : valentina-bounces at lists.macserve.net
[mailto:valentina-bounces at lists.macserve.net]De la part de Ruslan
Zasukhin
Envoye : mercredi 29 octobre 2003 14:35
A : valentina at lists.macserve.net
Objet : Re: SQL query IFNULL


on 10/29/03 15:29, Martin Kloss at martin.kloss at gmx.de wrote:

> At 14:03 29.10.2003, you wrote:
>> You can use functions only in BaseObject methods.
>> You need create BaseObject method and use it in SELECT.
>
> ok, I created a method "has_comment" with the calculation:
>
> IF(comment != '', 'j', 'n')
>
> But when selecting the records:
>
> SELECT id, has_comment FROM data
>
> all I get is "j", but some records don't have any data in the
> field, so I assume it's empty.
>
> IF(comment IS NULL, 'n', 'j')
>
> gives me the same result.

Try to check on small db with VAPP.


--
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------

_______________________________________________
Valentina mailing list
Valentina at lists.macserve.net
http://lists.macserve.net/mailman/listinfo/valentina



More information about the Valentina mailing list