🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.interbase.sql
Article #11155

Re: IIF or CASE

#11155
From: Bj�rge S�ther
Date: Wed, 04 Dec 2002 11:12
25 lines
1596 bytes
"nitebird" <nitebird@time.net.my> skrev i melding
news:3dec3d48$1@newsgroups.borland.com...
>
> Hi all,
>
> I'm able to use IIF in FoxPro ODBC and it generates really nice result.
The sample code is as follow:
>
> SELECT b.category,
>   SUM (iif(a.fperiod=1, qty*1 , 0)) as Jan,
>   SUM (iif(a.fperiod=2, qty*1 , 0)) as Feb,
>   SUM (iif(a.fperiod=3, qty*1 , 0)) as Mac,
> FROM aTable
> bil))/4)
> Group by category
>
> Can I do the same in IB?
> Is there any equivalent to IIF or CASE in IB?

You need to do that in an udf function. It can't do the "a.fperiod=1" stuff,
though, you'd need two parameters and do a compare.

--
Bj�rge S�ther
bjorge@hahaha_itte.no
Technical Details
Message-ID: <3dede2e3@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!fu-berlin.de!news.uni-x.net!newsgroups.borland.com!not-for-mail
References: <3dec3d48$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 114a0e,5f6f676ee9638e28
X-Google-Attributes: gid114a0e,public
X-Google-ArrivalTime: 2002-12-04 03:16:05 PST
From: "Bj�rge S�ther" <bjorge@hahaha_itte.no>
Newsgroups: borland.public.interbase.sql
References: <3dec3d48$1@newsgroups.borland.com>
Subject: Re: IIF or CASE
Date: Wed, 4 Dec 2002 12:12:58 +0100
Lines: 27
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 130.67.237.234
Message-ID: <3dede2e3@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1039000291 130.67.237.234 (4 Dec 2002 03:11:31 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!fu-berlin.de!news.uni-x.net!newsgroups.borland.com!not-for-mail