🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.interbase.sql
3 messages
3 total messages Started by nitebird Tue, 03 Dec 2002 05:12
IIF or CASE
#11286
Author: nitebird
Date: Tue, 03 Dec 2002 05:12
17 lines
1384 bytes
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?

TIA
Re: IIF or CASE
#11142
Author: Bill Todd
Date: Tue, 03 Dec 2002 14:29
30 lines
1595 bytes

On 2 Dec 2002 21:12:40 -0800, "nitebird" <nitebird@time.net.my> wrote:

>
>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?

No.

>Is there any equivalent to IIF or CASE in IB?

>
>TIA


--
Bill (TeamB)
(TeamB cannot respond to questions received via email)
Re: IIF or CASE
#11155
Author: 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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads