Subject | RE: [ib-support] Re: SQL: Number of entries per day |
---|---|
Author | Alan McDonald |
Post date | 2002-09-16T13:12:12Z |
cause you need to group by all of them
-----Original Message-----
From: Andrew Guts [mailto:andr@...]
Sent: Monday, 16 September 2002 23:07
To: ib-support@yahoogroups.com
Subject: Re: [ib-support] Re: SQL: Number of entries per day
How about one CAST(ts as date) instead of 3 EXTRACTs there?
Arno Brinkman wrote:
ADVERTISEMENT
To unsubscribe from this group, send an email to:
ib-support-unsubscribe@egroups.com
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
[Non-text portions of this message have been removed]
-----Original Message-----
From: Andrew Guts [mailto:andr@...]
Sent: Monday, 16 September 2002 23:07
To: ib-support@yahoogroups.com
Subject: Re: [ib-support] Re: SQL: Number of entries per day
How about one CAST(ts as date) instead of 3 EXTRACTs there?
Arno Brinkman wrote:
>Hi,Yahoo! Groups Sponsor
>
>
>
>> I was thinking of returning a date and the number of entries on that
>> day, i.e casting the timestamp using:
>>
>> CAST(TIME_STAMP as DATE)
>>
>> I've just tried:
>>
>> select CAST(ts as date), count(*) as entries
>> from run_log
>> group by CAST(ts as date)
>> having entries > 0
>>
>> but it complains about the group by entry - 'Unknown toekn CAST'
>>
>>
>
>Create a VIEW with EXTRACT and group by the VIEW columns.
>
>CREATE VIEW Example1
> (TableYear, TableMonth, TableDay) AS
>SELECT
> EXTRACT(YEAR FROM FieldX),
> EXTRACT(MONTH FROM FieldX),
> EXTRACT(DAY FROM FieldX)
>FROM
> ATable;
>
>SELECT
> TableYear,
> TableMonth,
> TableDay
>FROM
> Example1
>GROUP BY
> TableYear,
> TableMonth,
> TableDay
>
>Ofcourse adding your missing fields.
>Another way is creating computed by columns with EXTRACT() or UDF's.
>
>Regards,
>Arno
>
>
>
>
>To unsubscribe from this group, send an email to:
>ib-support-unsubscribe@egroups.com
>
>
>
>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
>
ADVERTISEMENT
To unsubscribe from this group, send an email to:
ib-support-unsubscribe@egroups.com
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
[Non-text portions of this message have been removed]