🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Extract

#700
From: Karol Bieniaszewski
Date: Wed, 25 Jul 2007 07:27
37 lines
1788 bytes
Uzytkownik "Thomas Steinmaurer" 
<t.steinmaurer_dontbugmewithspam@upscene.com> napisal w wiadomosci 
news:46a6ea91$1@newsgroups.borland.com...
>> IB 6.02
>>
>> Table :
>> CDate      Total
>> ---------------------
>> 01/20/07     100
>> 01/25/07     200
>> 02/10/07     300
>> 02/25/07     400
>> 03/28/07     500
>>
>> Requested Result :
>> Month    SumTotal
>> --------------------------
>> 01              300
>> 02              700
>> 03              500
>>
>> I tested
>> select extract(month from cdate), sum(total)
>> group by cdate
>> but i couldnt get eachmonth's total
>
> In this scenario, with IB 6.02, you need to create a view which has the 
> month information in its result and then group by this field.
>

use Firebird - there you can group by expression

select extract(month from cdate), sum(total)
group by extract(month from cdate)

Karol Bieniaszewski 
Technical Details
Message-ID: <46a6fae2@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <46a6e831$1@newsgroups.borland.com> <46a6ea91$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,6fd982b7bb1d6c61
X-Google-Attributes: gid114a0e,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Karol Bieniaszewski" <liviuslivius@poczta.onet.pl>
Newsgroups: borland.public.interbase.sql
References: <46a6e831$1@newsgroups.borland.com> <46a6ea91$1@newsgroups.borland.com>
Subject: Re: Extract
Date: Wed, 25 Jul 2007 09:27:44 +0200
Lines: 39
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 195.205.151.58
Message-ID: <46a6fae2@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1185348322 195.205.151.58 (25 Jul 2007 00:25:22 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail