Subject | Re: Gorup by |
---|---|
Author | Michael Vilhelmsen <Michael.Vilhelmsen@M |
Post date | 2003-02-21T11:34:18Z |
Thank you all.
I did this:
create view test8(
DATO,
DATO1,
YearYear,
MonthMonth,
TimeTime,
dayday,
ART,
SALGKR)
as
select
TRANSAKTIONER.DATO,
cast(cast(TRANSAKTIONER.DATO as char(11)) as date),
cast(extract(year from dato) as varchar(4)),
cast(extract(month from dato) as varchar(2)),
cast(extract(hour from dato) as varchar(2)),
cast(extract(day from dato) as varchar(2)),
TRANSAKTIONER.ART,
TRANSAKTIONER.SALGKR
from
TRANSAKTIONER;
That solved my problem.
Now I can group upon the hour, the day, the month or the year
Thank you all
Michael
--- In ib-support@yahoogroups.com, "Michael Vilhelmsen
<Michael.Vilhelmsen@M...>" <Michael.Vilhelmsen@M...> wrote:
I did this:
create view test8(
DATO,
DATO1,
YearYear,
MonthMonth,
TimeTime,
dayday,
ART,
SALGKR)
as
select
TRANSAKTIONER.DATO,
cast(cast(TRANSAKTIONER.DATO as char(11)) as date),
cast(extract(year from dato) as varchar(4)),
cast(extract(month from dato) as varchar(2)),
cast(extract(hour from dato) as varchar(2)),
cast(extract(day from dato) as varchar(2)),
TRANSAKTIONER.ART,
TRANSAKTIONER.SALGKR
from
TRANSAKTIONER;
That solved my problem.
Now I can group upon the hour, the day, the month or the year
Thank you all
Michael
--- In ib-support@yahoogroups.com, "Michael Vilhelmsen
<Michael.Vilhelmsen@M...>" <Michael.Vilhelmsen@M...> wrote:
> Hithe
>
> I have two things my customer wants.
>
>
> 1.
> In my DB there is a table containing some data of what had happend
> during some time.
> This table contains a field, definded as DATE.
> I contains both date and time.
>
> Now I would like to do a select like:
>
> Select
> MyDate
> Sum(Field1)
> from MyTable
> Group by MyDate.
>
> This results gives me a lot of records of the same day because of
> time.day.
> I would like to eliminate the time, so to get a sum of the entire
>
>
> 2.
> As above, but I would like to group by every hour of every day.
> My customer would like to se something like this:
>
> 2003.02.20 at 13.00-14.00 Something
> 2003.02.20 at 14.00-15.00 Something
> 2003.02.20 at 15.00-16.00 Something
> etc.
>
>
> Is this posible ?
>
> Regards
> Michael