Subject | Re: [ib-support] Row 2 column |
---|---|
Author | SyamSyah |
Post date | 2002-09-26T01:12:45Z |
Thank's for ur comment. But.. i can do it in oracle, i use DECODE function. There are any function like DECODE (oracle) in firebird/interbase ?
This the query :
SELECT
REK,
SUM(DECODE(JNR, '112', 1, 0)*ANG) AS R112,
SUM(DECODE(JNR, '321', 1, 0)*ANG) AS R321,
SUM(DECODE(JNR, '491', 1, 0)*ANG) AS R491,
SUM(ANG) AS TOTAL
FROM RTABLE
GROUP BY REK;
.: SyamSyah :.
This the query :
SELECT
REK,
SUM(DECODE(JNR, '112', 1, 0)*ANG) AS R112,
SUM(DECODE(JNR, '321', 1, 0)*ANG) AS R321,
SUM(DECODE(JNR, '491', 1, 0)*ANG) AS R491,
SUM(ANG) AS TOTAL
FROM RTABLE
GROUP BY REK;
.: SyamSyah :.
----- Original Message -----
From: Svein Erling Tysvaer
Subject: Re: [ib-support] Row 2 column
This isn't possible in a query, you have to use a report generator or
possibly a stored procedure (only possible if you know the number of
columns and their type in advance, and I am uncertain whether you can name
them as you would like to - a report generator is what you probably want).
Sorry,
Set
At 15:56 25.09.2002 +0700, you wrote:
>before, sorry for my poor english.
>
>I have a table like this :
>
>RID REK JNR ANG
>-------------------------
>001 0005 491 500
>002 0010 321 250
>003 0005 491 100
>004 0012 112 200
>005 0012 321 300
>
>I want to create result like this :
>
>REK 112 321 491 TOT
>----------------------------
>0005 600 600
>0010 250 250
>0012 200 300 500
>
>The question is how to create the query ???
[Non-text portions of this message have been removed]